The Wire · Showcase
VITEPRESS REWIRES URL HANDLING FOR CONSISTENCY ACROSS SSR
By RepoJournal · Filed · About Vue.js
The route is now the single source of truth for hash state, eliminating a parallel tracking system that behaved differently on server and client.
VitePress shipped a breaking refactor [1] that consolidates URL hash management into the route object itself, replacing the standalone `useData().hash` ref that maintained its own listener. This fixes a subtle SSR inconsistency where the current URL wasn't observed uniformly across server and client renders. The `isActive()` function now takes hash as an argument instead of reading `location.hash` at call time, making it pure and safe for server-side use. Alongside this, language switching now preserves query parameters [2], so filter state and search queries persist when users change locale. Image path normalization was tightened [3] to keep relative paths cleaner, and the `enhanceApp` hook gained expanded documentation [4] showing more integration patterns for app-level customization.
Action items
- → Review isActive() call sites in your themes - signature changed to require hash and matchPath arguments vuejs/vitepress [plan]
- → Test language switching flows if you use query params - this fix ensures they now persist across locale changes vuejs/vitepress [monitor]
References
- [1] refactor!: make the route the single source of truth for the URL hash vuejs/vitepress
- [2] fix(theme): preserve url params when switching languages (#5312) vuejs/vitepress
- [3] refactor: improve relative image path normalization ↗ vuejs/vitepress
- [4] docs: improve enhanceApp usecases ↗ vuejs/vitepress