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

fix(editor): don't create a duplicate import for aliased files #6062

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

liady
Copy link
Contributor

@liady liady commented Jul 11, 2024

Problem:
Currently when trying to import the same component from an import source that is aliased in the file, we incorrectly recognize it as a different source and create a duplicate import

Fix:
Take the alias mapping into consideration. The heavy lifting was done in the previous prep PR which was to pass this mapping into the mergeImports function.

To reproduce/test:
In our sample store project, locate the Grid with the six ProductCards, and try to move (simply move) one of the ProductCard inside that grid. It used to create a duplicate import.

Manual Tests:
I hereby swear that:

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

Fixes #5980

Copy link
Contributor

github-actions bot commented Jul 11, 2024

Try me

Copy link

relativeci bot commented Jul 11, 2024

#13327 Bundle Size — 62.62MiB (~+0.01%).

3ce9e31(current) vs 6339ece master#13325(baseline)

Warning

Bundle contains 51 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#13327
     Baseline
#13325
Regression  Initial JS 45.68MiB(~+0.01%) 45.68MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 21.21% 21.61%
No change  Chunks 30 30
No change  Assets 33 33
No change  Modules 4350 4350
No change  Duplicate Modules 524 524
No change  Duplicate Code 31.71% 31.71%
No change  Packages 450 450
No change  Duplicate Packages 51 51
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#13327
     Baseline
#13325
Regression  JS 62.61MiB (~+0.01%) 62.61MiB
Improvement  HTML 11.16KiB (-0.33%) 11.2KiB

Bundle analysis reportBranch fix/alised-importsProject dashboard

@liady liady merged commit 94d4235 into master Jul 11, 2024
16 checks passed
@liady liady deleted the fix/alised-imports branch July 11, 2024 09:39
liady added a commit that referenced this pull request Dec 13, 2024
**Problem:**
Currently when trying to import the same component from an import source
that is aliased in the file, we incorrectly recognize it as a different
source and create a duplicate import

**Fix:**
Take the alias mapping into consideration. The heavy lifting was done in
the previous prep PR which was to pass this mapping into the
`mergeImports` function.

**To reproduce/test:**
In our sample store project, locate the `Grid` with the six
`ProductCard`s, and try to move (simply move) one of the `ProductCard`
inside that grid. It used to create a duplicate import.

**Manual Tests:**
I hereby swear that:

- [X] I opened a hydrogen project and it loaded
- [X] I could navigate to various routes in Preview mode

Fixes #5980
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.

Import detection: Inserting the Spacer component and navigator-dragging it to reorder renames it to spacer_2
3 participants