router icon indicating copy to clipboard operation
router copied to clipboard

feat: add navigation-api router

Open userquin opened this issue 4 months ago • 8 comments

Right now I'm playing with it, once the features added we can start adding compatibility.

Looks like I've finished it, will need to review view transitions at legacy router an prepare some tests here: will port https://github.com/vuejs/router/pull/2552 PR to this PR to add some tests and a new playground.

You can play with the new Navigation API Router in my GH repo using this branch: https://github.com/userquin/vue-router-api/tree/nav-api-vue-router

userquin avatar Sep 12 '25 17:09 userquin

Deploy Preview for vue-router canceled.

Name Link
Latest commit 11632e0fabb7085619bc6551df213f93eac7d6e8
Latest deploy log https://app.netlify.com/projects/vue-router/deploys/68cb29b88fa4900008112974

netlify[bot] avatar Sep 12 '25 17:09 netlify[bot]

[!IMPORTANT]

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 12 '25 17:09 coderabbitai[bot]

Open in StackBlitz

npm i https://pkg.pr.new/vue-router@2551

commit: 11632e0

pkg-pr-new[bot] avatar Sep 12 '25 17:09 pkg-pr-new[bot]

Codecov Report

:x: Patch coverage is 7.89238% with 1027 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 71.10%. Comparing base (6171856) to head (11632e0). :warning: Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/router/src/navigation-api/index.ts 0.25% 781 Missing :warning:
packages/router/src/router.ts 20.47% 101 Missing :warning:
packages/router/src/focus.ts 4.81% 79 Missing :warning:
packages/router/src/utils/routes.ts 13.51% 32 Missing :warning:
packages/router/src/modern-router-factory.ts 8.33% 22 Missing :warning:
packages/router/src/navigationGuards.ts 76.74% 10 Missing :warning:
packages/router/src/transition.ts 71.42% 2 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2551       +/-   ##
===========================================
- Coverage   94.80%   71.10%   -23.71%     
===========================================
  Files          34       39        +5     
  Lines        3004     4094     +1090     
  Branches      846      851        +5     
===========================================
+ Hits         2848     2911       +63     
- Misses        153     1180     +1027     
  Partials        3        3               

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Sep 12 '25 17:09 codecov[bot]

arggg, changes in guardToPromiseFn breaks also current router, I need to review the logic: adding optional NavigationInformation parameter to guardToPromiseFn cannot be done with current method signature

userquin avatar Sep 13 '25 15:09 userquin

https://github.com/userquin/vue-router-api/tree/nav-api-vue-router using pkg-pr-new from this PR

userquin avatar Sep 14 '25 14:09 userquin

Maybe we can use a vue plugin for enableViewTransition, this way Nuxt can register the plugin (its current plugin can be simplified a lot with latest features added here)

userquin avatar Sep 15 '25 21:09 userquin

arggg, back/forward view transitions broken, reviewing code

userquin avatar Sep 17 '25 13:09 userquin