Last 12 weeks ยท 112 commits
3 of 6 standards met
I cooked some black magic to make it work. resolve posva/unplugin-vue-router#684 Summary by CodeRabbit New Features** Added a navigation guard that validates route parameters before entering pages. Enhanced IDE/type hints for route parameters in page definitions to improve editor autocompletion and correctness checks.
WIP / draft โ opening early for visibility, feedback welcome. Closes #2684 Problem When all loaders on a route are lazy, navigation completes while the loaders are still pending. A nested lazy loader (e.g. that s and then keeps loading) leaves the module-level loader current context pointing at its own entry. If a component renders during that window, called in reads that stale context as its parent, which: re-runs the parent loader (the "parent-page" loader is called twice on initial load), makes a loader nest under itself (), and, with two loaders in the same component, spins into an infinite render โ reload loop. The context global is set around a loader's execution and restored on ; lazy loaders restore it after navigation, racing with component rendering. Fix In , when invoked from inside a component () and not synchronously within a loader function, drop the ambient context โ in a component, loaders are always used at the root. A small depth counter ( / in ) wraps the actual loader-function call so genuinely nested loaders still nest correctly, even when first triggered synchronously from a component. Applied to both and . Test Added a regression test to the shared (runs for basic + Colada): a parent loader that resolves instantly, a child loader that nests it and keeps loading, and parent/child components that use the loaders directly. Written before the fix and confirmed failing first ( warning + parent loader called twice); passes after. Checks [x] โ full suite passes (1629) [x] [x] lint + format clean [ ] changelog / docs (if needed)
The segment encoding checks that the hex buffer is 2 characters long, then decodes it with . The problem is stops at the first character that is not a valid hex digit instead of failing, so a buffer where only the second character is invalid is accepted. For example, parses as (the is ignored) and silently produces a control character. Meanwhile and are correctly rejected, because there returns when the first character is not hex. So the current check only catches cases where the first digit is bad. This replaces the /range check with a test so both characters must be hex digits. The length is already guaranteed to be 2 at that point, and two hex digits are always within , so the explicit range check is no longer needed. The error message is unchanged. Added a test for alongside the existing case. Summary by CodeRabbit Bug Fixes Improved validation for hex-encoded route segments so invalid hex values now fail with a clearer error message. Prevents malformed hex codes from being accepted during parsing. Tests Added coverage to verify invalid hex input is rejected as expected (including stricter handling for non-hex characters).
Repro Minimal repro: https://github.com/pau-santesmasses/router-repro 1. 2. Click `index.vue/workspace_parent.vueindex.vue/workspaceindex.vue(tabs)/_parent.vuepath: ''/workspace(tabs)_parent.vueindex.vueTreeNode.compare(tabs)index_parent.vueindex.vue_parent.vueindex.vueindexTreeNode.compare_parentindex.vuevue-router@5.1.0vue-router/vite`)
Repository: vuejs/router. Description: ๐ฆ The official router for Vue.js Stars: 4643, Forks: 1287. Primary language: TypeScript. Languages: TypeScript (92.8%), Vue (5.8%), JavaScript (0.7%), HTML (0.5%), CSS (0.2%). License: MIT. Homepage: https://router.vuejs.org/ Topics: vue, vue-router. Latest release: v5.1.0 (1mo ago). Open PRs: 15, open issues: 32. Last activity: 23h ago. Community health: 75%. Top contributors: posva, dependabot-preview[bot], skirtles-code, nicodevs, pikax, Jinjiang, dependabot[bot], yyx990803, PeterAlfredLee, gophlet and others.