vuex-webextensions icon indicating copy to clipboard operation
vuex-webextensions copied to clipboard

Calling a vuex action in popup.js causing an infinite loop with a wrong commit payload

Open guyschlider opened this issue 4 years ago • 2 comments

Hey,

I'm trying to use this plugin in a chrome extension with a simple store:

import Vue from 'vue'
import Vuex from 'vuex'
import VuexWebExtensions from 'vuex-webextensions';

Vue.use(Vuex)

const SET_IS_ENABLED = 'SET_IS_ENABLED'

export default new Vuex.Store({
  state: {
    isEnabled: false,
  },
  mutations: {
    [SET_IS_ENABLED] (state, newV) {
      console.log('SET_IS_ENABLED with:', newV)
      state.isEnabled = newV
    }
  },
  actions: {
    updateEnabledState ({ commit }, newV) {
      console.log('updateEnabledState with: ', newV)
      commit(SET_IS_ENABLED, newV)
    }
  },
  getters: {
    isEnabled: (state) => state.isEnabled
  },
  modules: {
  },
  plugins: [VuexWebExtensions()]
})

When calling updateEnabledState I see an infinite loop: https://i.imgur.com/DugX402.png

Using: [email protected] [email protected] [email protected]

guyschlider avatar Jan 23 '21 08:01 guyschlider

Is this related to the syncActions? when setting to false - looks like its working?

guyschlider avatar Jan 23 '21 08:01 guyschlider

Recently I found this bug on the new Vuex-v4 branch, I gona investigate it and notice you here when it get fixed on npm

MitsuhaKitsune avatar Aug 05 '21 23:08 MitsuhaKitsune