Add a 'previousRoute' property to the Router instance #1791
nathanchase
started this conversation in
Ideas
Replies: 1 comment
-
This could be useful although it can already be added with a router guard: router.beforeEach((to, from) => {
to.meta.from = to
}) So the question would be if there are enough common use cases for this to be a default feature in router. FYI, this has been requested before, so it's worth checking issues in vuejs/router and vuejs/vue-router |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What problem is this solving
I'd like to see a
previousRoute
property available on the Router instance.This would be the value of where the router was previously - (
undefined
) if there is no such value.This is an upstream request that came from needing this property on the Nuxt 3 router:
nuxt/nuxt#15661
Proposed solution
Add a 'previousRoute' property to the Router instance.
Describe alternatives you've considered
Currently, I have to create a global middleware to store the previous route in Pinia, like so:
Beta Was this translation helpful? Give feedback.
All reactions