Skip to content

Commit

Permalink
fix(app): (backport from Qv2's q/app-*) preFetch may error out with n…
Browse files Browse the repository at this point in the history
…ewer vue-router #14172
  • Loading branch information
rstoenescu committed Sep 29, 2022
1 parent e76cff7 commit 103a815
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/templates/entry/client-prefetch.js
Expand Up @@ -30,7 +30,11 @@ function getMatchedComponents (to, router) {

if (!route) { return [] }

return Array.prototype.concat.apply([], route.matched.map(m => {
const matched = route.matched.filter(m => m.components !== void 0)

if (matched.length === 0) { return [] }

return Array.prototype.concat.apply([], matched.map(m => {
return Object.keys(m.components).map(key => {
const comp = m.components[key]
return {
Expand Down
1 change: 1 addition & 0 deletions app/templates/entry/server-entry.js
Expand Up @@ -123,6 +123,7 @@ export default context => {
// wait until router has resolved possible async hooks
router.onReady(() => {
const matchedComponents = router.getMatchedComponents()
.filter(m => m !== void 0)
.map(m => m.options /* Vue.extend() */ || m)

// no matched routes
Expand Down

0 comments on commit 103a815

Please sign in to comment.