fix(vue-app): serialize route meta to contain functions #9634
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Types of changes
Description
This pull request serializes
route.meta
inrecursiveRoutes
inrouter.js
JSON.stringify
is lossy, especially with regards to functions. vue-router meta should be able to support functions for things such as having a dynamic route name. UsingJSON.stringyfy
removes all of these functions, whereasserialize()
preserves them. I assumed it to be safe to use, as it is also used forroute.redirect
androute.props
in the same file.This problem is shown in (this)[https://codesandbox.io/s/kind-glitter-ui9lm?file=/pages/page.vue] code sandbox, by going to the
/page
route, and clicking the button, the router meta is printed to the console.Checklist:
I have not added a test as I could not find a test file for the relevant functionality, and it seemed too integrated for me to be comfortable writing my own test for it.
Locally
packagers/cli/test/unit/command.test.js
is failing oncli/command > returns Builder instance
, but was already failing before I made any edits.