Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When loading component descriptors, take account of file mappings. #5781

Merged
merged 1 commit into from
May 31, 2024

Conversation

seanparsons
Copy link
Contributor

@seanparsons seanparsons commented May 29, 2024

Problem:
If you annotate a component with the full module path as module name (e.g. /app/components/hydrogen/new/Layout), then if it is imported using the short path (e.g. @h2/new/Layout), the component will not be recognized and connected to the annotation.

Fix:
The logic for looking up the component descriptors didn't take account of the mappings found in jsconfig.json, now it applies the mappings and then does a lookup of the filename.

Commit Details:

  • importedFromWhere now invokes applyFilePathMappingsToFilePath for the path that it returns so that it applies the path mapping rules to the results gained.
  • Added a call to getFilePathMappings in a few places to support a call to getComponentDescriptorForTarget.

Manual Tests:
I hereby swear that:

  • I opened a hydrogen project and it loaded
  • I could navigate to various routes in Preview mode

Fixes #5734

…le mappings.

- `importedFromWhere` now invokes `applyFilePathMappingsToFilePath`
  for the path that it returns so that it applies the path mapping rules to the
  results gained.
- Added a call to `getFilePathMappings` in a few places to support a call to
  `getComponentDescriptorForTarget`.
@seanparsons seanparsons changed the title fix(inspector) When loading component descriptors, take account of fi… When loading component descriptors, take account of file mappings. May 29, 2024
Copy link
Contributor

github-actions bot commented May 29, 2024

Try me

Copy link

relativeci bot commented May 29, 2024

#12727 Bundle Size — 62.26MiB (~+0.01%).

cf8961a(current) vs 6339ece master#12724(baseline)

Warning

Bundle contains 51 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#12727
     Baseline
#12724
Regression  Initial JS 45.33MiB(~+0.01%) 45.33MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 22.1% 22.52%
No change  Chunks 30 30
No change  Assets 33 33
No change  Modules 4294 4294
No change  Duplicate Modules 521 521
No change  Duplicate Code 31.78% 31.78%
No change  Packages 448 448
No change  Duplicate Packages 51 51
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#12727
     Baseline
#12724
Regression  JS 62.25MiB (~+0.01%) 62.25MiB
Improvement  HTML 11.16KiB (-0.33%) 11.2KiB

Bundle analysis reportBranch fix/component-annotation-file-ma...Project dashboard

Copy link
Contributor

Performance test results:
(Chart1)
(Chart2)

@seanparsons seanparsons merged commit 872b256 into master May 31, 2024
17 checks passed
@seanparsons seanparsons deleted the fix/component-annotation-file-mappings branch May 31, 2024 09:30
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.

Using an import path from jsconfig.json (e.g. @h2 in the sample store) causes component annotation troubles
4 participants