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

LocalStorage: vuex plugins error #1680

Closed
pinghe opened this issue Mar 2, 2018 · 2 comments
Closed

LocalStorage: vuex plugins error #1680

pinghe opened this issue Mar 2, 2018 · 2 comments
Milestone

Comments

@pinghe
Copy link

pinghe commented Mar 2, 2018

Software version

Quasar: v0.15.5
OS: Windows
Node: 9.6.1
NPM: 5.6.0
Browsers: chrome

quasar.conf.js

    framework: {
      ...
      plugins: [
        'LocalStorage',
        'Notify'
      ]
    },

store/index.js

import Vue from 'vue'
import Vuex from 'vuex'

import { LocalStorage } from 'quasar'

Vue.use(Vuex)

const testPlugin = store => {
   if (LocalStorage.has('testkey')) {
   } else {
   }

  store.subscribe((mutation, state) => {
  })
}

const store = new Vuex.Store({
  strict: true,

  state: {
  },
  mutations: {

  },
  modules: {
  },
  plugins: [
    testPlugin
  ]
})

export default store

error messages:

index.js?e3b1:14 Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_3_quasar__.b.has is not a function
@rstoenescu
Copy link
Member

Fixing this corner-case. Vuex store code runs before Quasar plugins get installed.

There's one easy fix from CLI but it needs to turn both router and store exports as functions than direct reference to Router and Store. But won't do this as it adds a bit of overhead and it's a breaking change.

The fix I'm going to write is to install plugins on demand automatically.

@rstoenescu
Copy link
Member

rstoenescu commented Mar 2, 2018

Fix available in 0.15.6. Found a much better way through CLI, a third solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants