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

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

Closed
maltenuhn opened this issue Jun 18, 2024 · 0 comments · Fixed by #6062
Assignees

Comments

@maltenuhn
Copy link
Member

Problem
Inserting the Spacer component in sample project works fine. When you navigator-drag it to reorder it though it all behaves suboptimally and it gets re-imported as Spacer_2.

Image

Solution

  1. Let spacers be spacers
  2. No illegal re-imports
liady added a commit that referenced this issue 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
`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 a pull request may close this issue.

2 participants