Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefetch feature breaks app #14172

Closed
cirolosapio opened this issue Aug 11, 2022 · 5 comments
Closed

Prefetch feature breaks app #14172

cirolosapio opened this issue Aug 11, 2022 · 5 comments
Assignees
Labels
area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@cirolosapio
Copy link
Contributor

cirolosapio commented Aug 11, 2022

What 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?

  1. open stackblitz repro
  2. navigate to about page and see it works
  3. enable prefetch feature in quasar.conf.js
  4. uncomment prefetch code in MainLayout.vue
  5. navigate to about page
  6. 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
      }
    })
  }))
}
@github-actions github-actions bot added area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite labels Aug 11, 2022
@TobyMosque
Copy link
Contributor

TobyMosque commented Aug 11, 2022

@cirolosapio
Copy link
Contributor Author

image https://stackblitz.com/edit/quasarframework-e3tw2y?file=src%2Flayouts%2FMainLayout.vue,quasar.config.js

i've updated the steps
to reproduce the error try to navigate to about page

@rstoenescu
Copy link
Member

Thank you for reporting!
Fix will be available in q/app-vite 1.0.7 and q/app-webpack 3.5.10

@cirolosapio
Copy link
Contributor Author

hi, is there an ETA for this fix?

@rstoenescu
Copy link
Member

hi, is there an ETA for this fix?

Later today (Wednesday 14th). Big releases for most Quasar packages with inter-dependencies, which is why it took a bit longer this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

3 participants