Repository navigation
Conversation
🦋 Changeset detectedLatest commit: b303c6a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A front end such as ReactiveScript's
.rxcannot hot-update its modules today: every edit reloads the page.Root cause
A front end's output can be shaped so that the refresh pass finds no component to swap. A non-entry
.rxmodule compiles toexport default function module(__rt) { … }, a factory the runtime runs once per app, so the pass emits noimport.meta.hot.accept. The front end could add its own HMR code, but it has no way to tell that a transform serves a dev client with refresh on. It also cannot shape the module list Vite updates. A front end that compiles a whole program from its entry watches every module from the entry (addWatchFile), so any edit reaches the entry and reloads the page, even when the edited module accepts its own update.What changed
FrontendContext.hotistruewhen the transform serves a dev client and the refresh pass runs on the output (needRefresh), andfalseotherwise. It is left unset in the dependency scan and in the stylesheet recompile.Frontend.hotUpdate(context)is optional. It runs in the client environment'shotUpdate, gets{ file, modules, read, root }, and returns the modules to update, or nothing to keep Vite's list. The plugin still adds the file's CSS module after it. If the hook throws, the plugin logs a warning and keeps Vite's list. The built-in lazy.rxfront end forwards the hook once its package has loaded.Both are additive, so front ends that do not use them behave as before. ReactiveScript's front end uses them in solidjs/reactivescript#68: it adds its own accept handling when
hotis set, and itshotUpdatedrops the entry's watch-only modules when only a dependency's components changed.Verification
vitest run: 149 pass.frontends.test.tschecks thathotistruein a client transform andfalseunder SSR, and that the hook's list replaces Vite's, with the CSS module added after.tsc --noEmitis clean.solid-v2/with-reactivescripttemplate, Playwright checked edits toCounter.rx. Markup,<style>and logic edits hot-swap with no reload and keep the guestbook's entries and the current user. Top-level and entry edits reload.🤖 Generated with Claude Code