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

Improves HMR logic with proper parser #9356

Closed
wants to merge 1 commit into from
Closed

Conversation

natemoo-re
Copy link
Member

Changes

  • Resolves Style-only changes in .astro files don't use HMR consistently #9262
  • This PR improves our HMR logic by refactoring our style detection to actually use the AST provided by the compiler.
  • Previously, we were doing a best-effort attempt at determining if only a style had changed. This approach had some subtly inconsistent behavior due to the order in which modules were invalidated.
  • Since our compiler now has a proper parse mode that provides a full AST, our HMR logic can be much more exact.

Testing

Tested manually, but will try to add an E2E test to replicate the issue reported

Docs

N/A, bug fixes

Copy link

changeset-bot bot commented Dec 6, 2023

⚠️ No Changeset found

Latest commit: 68968b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Dec 6, 2023
@bluwy
Copy link
Member

bluwy commented Dec 7, 2023

I think my main concern is with performance. Before, we're doing string manipulations from the compile result (that was also cached and used in transform() hook). With this PR, we're doing two parse() and AST serialization that aren't cached, which could be costly. Maybe it's worth checking the perf implications of this 🤔

@bluwy bluwy closed this in #9712 Jan 19, 2024
@bluwy bluwy deleted the feat/smart-hmr branch October 8, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Style-only changes in .astro files don't use HMR consistently
2 participants