Closed AnnaMadsenKnowit closed 1 year ago
The fix is intended, it only discards params when a path is provided, in which cases params are extracted from the path anyway. It was to avoid unnecessary warnings in the console. You can still pass the name
instead of a path to the redirect record redirect: { name: '...' }
What problem is this solving
Hi,
Prior to version 4.1, params were automatically passed on when redirecting. After commit 8d12db4, this was disabled and all params must be specified in the redirect route itself.
Although I agree transferring params should not be default behavior, I would very much appreciate if it had been possible to specify whether or not params should be transferred to the redirect or not. In our case, all our redirects share params with its from-route, so specifying the params for each sub-route requires a lot of boilerplate they way things are after version 4.1.
PS. This is my first feature proposal, so I'm sorry if anything is wrong in the post. Just tell me if I should do anything differently.
Proposed solution
A solution could be to add a flag to the RouteRecordRedirectOption type, where you may specify if you want the params to be transferred.
Describe alternatives you've considered
A different solution could possibly be to add an extra property, e.g.
redirectWithParams
, parallel to the regularredirect
property. If this property is used, where the params are transferred.I am not fully familiar with the vue-router API, so there may very well be better solutions than this, but I hope you get my point.