Prefetch feature breaks app
See original GitHub issueWhat happened?
As of vue-router@4.1.0 we can define a route without specify a component when prefetch feature is enabled it throws an error
What did you expect to happen?
should work fine
Reproduction URL
quasar-prefetch + unplugin-vue-router quasar-prefetch
How to reproduce?
- open stackblitz repro
- navigate to about page and see it works
- enable prefetch feature in
quasar.conf.js
- uncomment prefetch code in
MainLayout.vue
- navigate to about page
- see error in console
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)
Quasar info output
Operating System - Linux(5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36) - linux/x64
NodeJs - 16.14.2
Global packages
NPM - 7.17.0
yarn - 1.22.10
@quasar/cli - undefined
@quasar/icongenie - Not installed
cordova - Not installed
Important local packages
quasar - 2.7.7 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
@quasar/app-vite - 1.0.6 -- Quasar Framework App CLI with Vite
@quasar/extras - 1.15.1 -- Quasar Framework fonts, icons and animations
eslint-plugin-quasar - Not installed
vue - 3.2.37 -- The progressive JavaScript framework for building modern web UI.
vue-router - 4.1.3
pinia - Not installed
vuex - Not installed
vite - 2.9.14 -- Native-ESM powered web dev build tool
eslint - 8.21.0 -- An AST-based pattern checker for JavaScript.
electron - Not installed
electron-packager - Not installed
electron-builder - Not installed
register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
@capacitor/core - Not installed
@capacitor/cli - Not installed
@capacitor/android - Not installed
@capacitor/ios - Not installed
Quasar App Extensions
*None installed*
Networking
Host - quasarframework-wllnsp
en0 - 192.168.1.104
Relevant log output
Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at client-prefetch.js?t=1660229188863:35:19
at Array.map (<anonymous>)
at getMatchedComponents (client-prefetch.js?t=1660229188863:34:57)
at client-prefetch.js?t=1660229188863:53:17
at chunk-BLWP2ZRC.js?v=c49f912b:1425:31
at new Promise (<anonymous>)
at chunk-BLWP2ZRC.js?v=c49f912b:1404:16
at chunk-BLWP2ZRC.js?v=c49f912b:2576:63
Additional context
// client-prefetch.js
function getMatchedComponents (to, router) {
const route = to
? (to.matched ? to : router.resolve(to).route)
: router.currentRoute.value
if (!route) { return [] }
return Array.prototype.concat.apply([], route.matched.map(m => {
return Object.keys(m.components).map(key => { // <-- this line cause error
const comp = m.components[key]
return {
path: m.path,
c: comp
}
})
}))
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Prefetching - Qwik - Builder.io
Prefetching is a way for applications to begin downloading modules in a background task, before the user may actually require these modules. The...
Read more >Improving performance with background data prefetching
We recently decided to focus on effective background prefetching as a way to break the dependency of Instagram usability from network ...
Read more >Prefetch – Vercel Docs
SvelteKit uses code-splitting to break up your app into small chunks of code, one per route. This ensures fast startup times since your...
Read more >Prefetch Objects - Akamai TechDocs
Prefetching instructs edge servers to retrieve content from the origin, such as images and scripts embedded in HTML content, at the same time...
Read more >Preload, Prefetch And Priorities in Chrome - Medium
Prefetch is a hint to the browser that a resource might be needed, ... preloading key late-discovered scripts for their Progressive Web App:....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for reporting! Fix will be available in q/app-vite 1.0.7 and q/app-webpack 3.5.10
Later today (Wednesday 14th). Big releases for most Quasar packages with inter-dependencies, which is why it took a bit longer this time.