MitsuhaKitsune / vuex-webextensions

A Vuex plugin to share store through webextensions components
MIT License
83 stars 30 forks source link

How to set state non persistentStates #23

Closed tuantmtb closed 5 years ago

tuantmtb commented 5 years ago

Currently, store have "currentUrl" = windows.location.href

export default new Vuex.Store({
  state: {
    urlCurrent: null
  },
  getters,
  mutations,
  actions,
  plugins: [
    VuexWebExtensions({
      persistentStates: []
    })
  ]
})

Currently, I open 2 tabs, state auto change value urlCurrent. I want to state urlCurrent will not change when I open other tab. How can I disable sync state: urlCurrent

Here is my package.json:

{
"dependencies": {
    "axios": "^0.19.0",
    "vue": "^2.6.10",
    "vue-router": "^3.0.7",
    "vuex": "^3.1.1",
    "vuex-webextensions": "^1.2.7",
    "webextension-polyfill": "^0.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.5.4",
    "@babel/plugin-proposal-optional-chaining": "^7.2.0",
    "@babel/preset-env": "^7.5.4",
    "@babel/runtime-corejs3": "^7.5.4",
    "archiver": "^3.0.0",
    "babel-eslint": "^10.0.2",
    "babel-loader": "^8.0.6",
    "copy-webpack-plugin": "^5.0.3",
    "core-js": "^3.1.4",
    "cross-env": "^5.2.0",
    "css-loader": "^3.0.0",
    "ejs": "^2.6.2",
    "eslint": "^6.0.1",
    "eslint-config-standard": "^12.0.0",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-loader": "^2.2.1",
    "eslint-plugin-import": "^2.18.0",
    "eslint-plugin-node": "^9.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^5.2.3",
    "file-loader": "^4.0.0",
    "mini-css-extract-plugin": "^0.7.0",
    "node-sass": "^4.12.0",
    "sass-loader": "^7.1.0",
    "vue-loader": "^15.7.0",
    "vue-template-compiler": "^2.6.10",
    "web-ext-types": "^3.2.0",
    "webpack": "^4.35.3",
    "webpack-cli": "^3.3.5",
    "webpack-extension-reloader": "^1.1.0"
  }
}
tuantmtb commented 5 years ago

up

MitsuhaKitsune commented 5 years ago

Sorry, didn't know why I not get notified the first time.

For now the extension didn't have the feature for no sync states, but it's a nice idea, when I come back to home I check it.

Greetings and thanks for the report.

tuantmtb commented 5 years ago

Thank so much! I think it is a awesome feature ! Hope you update very soon.

MitsuhaKitsune commented 5 years ago

If I understand fine, the feature that you request are available on the recent uploaded version (1.2.8).

I bring the hability to skip the sync process on selected mutations through config, but remember that without sync, you need update the value on all desired contexts manually.

Greetings