Skip to content

fix: correct submodule name extraction for nested interfaces modules#1877

Merged
aemada-aws merged 3 commits intomainfrom
fix-interfaces-nested-modules
Nov 18, 2025
Merged

fix: correct submodule name extraction for nested interfaces modules#1877
aemada-aws merged 3 commits intomainfrom
fix-interfaces-nested-modules

Conversation

@aemada-aws
Copy link
Copy Markdown
Contributor

@aemada-aws aemada-aws commented Nov 18, 2025

With the addition of aws-cdk-lib.interfaces.* submodules, the previous logic incorrectly extracted only 'interfaces' as the submodule name for all nested interface modules (aws-cdk-lib.interfaces.aws_s3, aws-cdk-lib.interfaces.aws_ec2, etc.), causing all interface submodules to display as 'interfaces' and point to the same page.

Currently this is how it looks like on https://constructs.dev/packages/aws-cdk-lib/v/2.225.0?lang=typescript and all the links are broken.

Screenshot 2025-11-18 at 17 49 42 After the fix: Screenshot 2025-11-18 at 17 50 21

and inside one of the pages

Screenshot 2025-11-18 at 17 50 57

Changes:

  • Instead of taking the first string after the dot, we replace "*." from the submodule name
  • Added unit tests

Also closes #1853

With the addition of aws-cdk-lib.interfaces.* submodules, the previous logic
incorrectly extracted only 'interfaces' as the submodule name for all nested
interface modules (aws-cdk-lib.interfaces.aws_s3, aws-cdk-lib.interfaces.aws_ec2, etc.),
causing all interface submodules to display as 'interfaces' and point to the same page.

Changes:
- Replace expensive split().slice().join() with fast substring() operation
- Remove getUrl callback dependency to prevent unnecessary useMemo recalculations
- Add detailed comments with examples showing correct extraction
- Update tests to verify actual UI behavior shows proper nested names
- Now correctly shows 'interfaces.aws_s3', 'interfaces.aws_ec2' etc. instead of just 'interfaces'
Replace substring approach with regex /^[^.]+\./ for better readability
and more expressive code while maintaining the same performance benefits.
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@aemada-aws aemada-aws disabled auto-merge November 18, 2025 18:25
@aemada-aws aemada-aws enabled auto-merge November 18, 2025 18:25
@aemada-aws aemada-aws added this pull request to the merge queue Nov 18, 2025
@aemada-aws aemada-aws mentioned this pull request Nov 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 18, 2025
@aemada-aws aemada-aws added this pull request to the merge queue Nov 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 18, 2025
@aemada-aws aemada-aws added this pull request to the merge queue Nov 18, 2025
Merged via the queue into main with commit 6bb241d Nov 18, 2025
8 of 10 checks passed
@aemada-aws aemada-aws deleted the fix-interfaces-nested-modules branch November 18, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nested modules issue

3 participants