Skip to content

fix(vite): hot-update vue screens on plain .ts edits - #11478

Merged
NathanWalker merged 1 commit into
mainfrom
fix/vite-vue-ts-hmr
Sep 29, 2026
Merged

NathanWalker merged 1 commit into
mainfrom
fix/vite-vue-ts-hmr

Conversation

@NathanWalker

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

In a nativescript-vue app, editing a plain .ts module (data, composables, a computed theme value) hot-updates nothing on screen, even when a .vue screen imports it directly. .vue and .css edits work.

Two causes:

  1. populateInitialGraph walked a hardcoded src/ directory. nativescript-vue apps default to appPath: 'app', so the HMR module graph started empty ([hmr-ws][populate] modules=0). With no importer edges, the Vue client's findNearestSfcBoundaries could never trace the edited module to a .vue component. The Angular template watcher had the same src/ hardcoding.
  2. Once the graph is populated, dependency propagation replaced the whole app root with the nearest boundary. That is often a screen that isn't displayed (e.g. AlbumDetail.vue, or a lone NowPlayingBar.vue), which wipes the shell and navigation stack.

What is the new behavior?

  • The initial graph walk and the Angular template walk use the configured appPath. The walk moves into listRuntimeGraphSourceFiles in runtime-graph-filter.ts.
  • propagateDepChangeToSfcBoundary re-assembles every importing .vue boundary and reloads its mounted instances in place through Vue's HMR runtime (tryInPlaceVueReload), as the .vue edit 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'):

  • Editing a data module (music.ts) and a theme module (appearance.ts) now updates the visible screen in place.
  • The same edit applies in place while a pushed page is on top, and the page stays pushed.
  • .vue and .css edits are unchanged.
  • Angular, Solid and Octane apps (appPath: 'src') behave exactly as before for .ts/.tsx/.html/.css edits.

Tests: runtime-graph-filter.spec.ts covers the new walker (app-dir files only; skips dependency, hidden and test dirs, and declarations). vue/client/strategy.spec.ts covers in-place reload across multiple boundaries with no root reset, and the nearest-boundary fallback without the runtime.

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.
@nx-cloud

nx-cloud Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 4cee5d3

Command Status Duration Result
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-29 23:38:50 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11478
npm i https://pkg.pr.new/@nativescript/vite@11478
npm i https://pkg.pr.new/@nativescript/webpack@11478

commit: 4cee5d3

@NathanWalker
NathanWalker merged commit e3719ad into main Sep 29, 2026
10 checks passed
@NathanWalker
NathanWalker deleted the fix/vite-vue-ts-hmr branch September 29, 2026 23:41
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 this pull request may close these issues.

1 participant