fix(vite): hot-update vue screens on plain .ts edits - #11478
Merged
Merged
Conversation
The initial HMR graph walk was hardcoded to src/, so apps with another appPath (nativescript-vue's default app/) had no importer edges and a .ts edit never reached a .vue boundary. The walk now uses the configured appPath, as does the Angular template watcher. Dependency propagation now reloads every importing .vue boundary in place through Vue's HMR runtime instead of replacing the app root with the nearest one, so the shell and navigation stack survive.
|
View your CI Pipeline Execution ↗ for commit 4cee5d3
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
4 of 5 tasks
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.
PR Checklist
What is the current behavior?
In a nativescript-vue app, editing a plain
.tsmodule (data, composables, acomputedtheme value) hot-updates nothing on screen, even when a.vuescreen imports it directly..vueand.cssedits work.Two causes:
populateInitialGraphwalked a hardcodedsrc/directory. nativescript-vue apps default toappPath: 'app', so the HMR module graph started empty ([hmr-ws][populate] modules=0). With no importer edges, the Vue client'sfindNearestSfcBoundariescould never trace the edited module to a.vuecomponent. The Angular template watcher had the samesrc/hardcoding.AlbumDetail.vue, or a loneNowPlayingBar.vue), which wipes the shell and navigation stack.What is the new behavior?
appPath. The walk moves intolistRuntimeGraphSourceFilesinruntime-graph-filter.ts.propagateDepChangeToSfcBoundaryre-assembles every importing.vueboundary and reloads its mounted instances in place through Vue's HMR runtime (tryInPlaceVueReload), as the.vueedit path already does. Unmounted boundaries are a no-op, so only visible components re-render, and the shell, tabs and pushed pages stay put. When the HMR runtime is unavailable, it falls back to remounting the nearest boundary as root, as before.Verified on the iOS simulator with a nativescript-vue app (
appPath: 'app'):music.ts) and a theme module (appearance.ts) now updates the visible screen in place..vueand.cssedits are unchanged.appPath: 'src') behave exactly as before for.ts/.tsx/.html/.cssedits.Tests:
runtime-graph-filter.spec.tscovers the new walker (app-dir files only; skips dependency, hidden and test dirs, and declarations).vue/client/strategy.spec.tscovers in-place reload across multiple boundaries with no root reset, and the nearest-boundary fallback without the runtime.