Fix glob importer cache in development #1578
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #1545
We were invalidating the client components cache after 100ms (throttling it), but Vite refreshes the browser faster than that. As a result, we were getting the old list of client components instead of the new one. Removing the 100ms timeout fixes the issue (and it wasn't needed anymore).
@benjaminsehl @juanpprieto @lordofthecactus Can you play with this and see if you can find other situations where it breaks? I tested the situation where you import a new client component for the first time in a any server component, and it seems to be fixed now.
-- Edit: this PR is also adding the same changes that Shopify/hydrogen#1577 is adding because the code comes from the PR we have in React repo. #1577 should be merged before this one.
The real change to review in this PR is basically here: facebook/react@c8a747d
Before submitting the PR, please make sure you do the following:
fixes #123
)yarn changeset add
if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning