quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.97k stars 3.53k forks source link

Loading in router.beforeEach throws #15287

Closed ivanpepelko closed 1 year ago

ivanpepelko commented 1 year ago

What happened?

After recent commit (https://github.com/quasarframework/quasar/commit/2208e659842eb6b73a1e55fb55e3baf4dc824abf, release 2.11.5), calling Loading.show in router.beforeEach throws an exception:

image

What did you expect to happen?

Calling Loading.show not to throw exception.

Reproduction URL

https://codesandbox.io/s/friendly-currying-rk88k7?file=/src/router/index.js

How to reproduce?

In src/router/index.ts, in route wrapper callback, after calling createRouter, add this:

  Router.beforeEach(() => {
    Loading.show();

    window.setTimeout(() => {
      Loading.hide();
    }, 500);
  });

Flavour

Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)

Areas

Plugins (quasar)

Platforms/Browsers

Firefox, Chrome

Quasar info output

Operating System - Linux(6.1.6-arch1-1) - linux/x64
NodeJs - 16.18.0

Global packages
  NPM - 8.19.2
  yarn - 1.22.19
  @quasar/cli - undefined
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.11.5 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-webpack - 3.7.1 -- Quasar Framework App CLI with Webpack
  @quasar/extras - 1.15.9 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.45 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.6
  pinia - 2.0.29 -- Intuitive, type safe and flexible Store for Vue
  vuex - Not installed
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  @babel/core - 7.20.12 -- Babel compiler core.
  webpack - 5.75.0 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  webpack-dev-server - 4.11.1 -- Serves a webpack app. Updates the browser on changes.
  workbox-webpack-plugin - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  typescript - 4.9.4 -- TypeScript is a language for application scale JavaScript development
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  *None installed*

Relevant log output

No response

Additional context

No response

rstoenescu commented 1 year ago

Hi,

In your example you do not install the "Loading" plugin (quasar.config.js > framework > plugins = [ 'Loading' ]). Please reopen or comment here if you forgot to add it in the reproduction repo only.