Comments (7)
@marvinosswald @miyanokomiya @Ksistof
Hey guys,
I've added the example project and updated documentation a little bit. I'm sorry, I really missed one step in Installation
guide.
In case if you are using createSharedMutations()
you need to create an instance of Vuex Store in the main process. Just add such line to your main process:
import './path/to/your/store'
Also, you could check the example project:
– https://github.com/vue-electron/vuex-electron-example
Let me know if you have any questions.
Have a nice day ;)
from vuex-electron.
Is it necessary for working the plugin 'createSharedMutations' to init Vuex at main process and all renderer processes?
When I did it the plugin worked, but I have no confidence that it's correct usage.
I want a sample project which teaches me how to use 'vuex-electron'.
from vuex-electron.
The devs should at least write out an error message if this fails, though, and save a headache for other developers.
from vuex-electron.
@miyanokomiya Could you please provide your code of main.js? I am trying to make it work with no luck. Thanks
from vuex-electron.
@Ksistof
The plugin 'createSharedMutations' seems to make the store global for all processes.
All processe have original state, but each state has the same value by 'createSharedMutations'.
If renderer processes dispach actions, the actions is cancelled in renderer processes and notify main process to do the actions.
If main process commit mutations, the mutations change state of that and notify renderer processes to do the same mutations to change each state of them.
If renderer processes commit mutations, a error occurs.
The only thing I did is to init Vuex from main process and renderer process.
src
- main.js
- renderderMain.js
- store.js
main.js
import './store' // this code makes 'vuex-electron' work well
~~~ normar code to init electron app ~~~
renderderMain.js
import Vue from 'vue'
import store from './store'
import App from './App'
if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
new Vue({
components: { App },
store,
template: '<App/>'
}).$mount('#app')
store.js
import Vue from 'vue'
import Vuex from 'vuex'
import { createPersistedState, createSharedMutations } from 'vuex-electron'
Vue.use(Vuex)
export default new Vuex.Store({
~~~ state, actions etc... ~~~,
plugins: [createPersistedState(), createSharedMutations()],
strict: process.env.NODE_ENV !== 'production'
})
from vuex-electron.
Solved, thanks @MrEmelianenko for the neat example !
from vuex-electron.
Why is it closed, the issue is still there!! Just spent hours on debugging this silly thing 😤 SimulatedGREG/electron-vue#733
from vuex-electron.
Related Issues (20)
- Not updating the state HOT 4
- Maintainers required HOT 5
- Unable to use code in actions with createSharedMutations HOT 3
- Locally stored state doesn't get updated and causes weird merges HOT 4
- caching data In nuxt js , vue
- Bump deepmerge
- vuex-electron doesn't support batch deleting by condition from vuex-orm HOT 2
- Could not find a declaration file HOT 1
- dispatch HOT 1
- No way to configure the electron-store instance outside of changing the file name HOT 1
- Failed to serialize arguments HOT 2
- [shared data] Master init failed HOT 3
- [Vuex Electron] Storage is not valid HOT 4
- How to rehydrate after restarting or reloading. HOT 2
- No console or network logged HOT 1
- [conf, ajv] DevTools failed to load SourceMaps HOT 4
- [fix] [Vuex Electron] Storage is not valid. Please, read the docs.
- 'createPersistedState' add options 'cwd'?
- Webpack 5 incompatibility
- the package electron-store is not lastest ,Cannot read properties of undefined (reading 'app') HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuex-electron.