Giter Site home page Giter Site logo

Comments (7)

Stormtv avatar Stormtv commented on July 17, 2024 3

I think I ran into this issue before

Did you make sure to

import store from '../renderer/store'

inside your electron index.js (the one where the createWindow function and auto updater is)
I'm not sure why this required in the build even if the variable is unused but I haven't had time to figure it out

from vuex-electron.

mittalyashu avatar mittalyashu commented on July 17, 2024 1

The solution of this problem is already mentioned in the readme.md file.

We need to import store in the main/index.js file only if we want to use createSharedMutations plugin. Otherwise we don't have to do it.

from vuex-electron.

daniel-farina avatar daniel-farina commented on July 17, 2024

Confused about this. I had the exact same issue as @BlackConure and it adding

import store from '../renderer/store'

as mentioned by @Stormtv to the src/main/index.js fixed the issue for me. Dispatching to store is now working.

Thank you

from vuex-electron.

SGarno avatar SGarno commented on July 17, 2024

Why would you need to import the store but not reference it anywhere? In Nuxt, the store is in this.$store. By doing an import and having it work seems to suggest that somewhere down the line it is referencing window.store instead of this.store (?)

@daniel-farina I am using Nuxt which doesn't use src/main/index.js and doesn't have '../renderer/store'. Store in Nuxt is added via /store/index.js file. My code is more like this:

import Vuex from 'vuex';
import { createPersistedState, createSharedMutations } from 'vuex-electron';

const createStore = () => {
	return new Vuex.Store({
		state: {},
		plugins: [ createPersistedState(), createSharedMutations() ],
		mutations: {},
		actions: {},
		strict: process.env.NODE_ENV !== 'production'
        });
}

For now, I am using originalDispatch() until this can get addressed.

from vuex-electron.

akodkod avatar akodkod commented on July 17, 2024

@SGarno you need to create an instance of the store in all your processes (main and renderer), so they could communicate with each other.

from vuex-electron.

mittalyashu avatar mittalyashu commented on July 17, 2024

I am still facing this issue, I have even imported vuex store in the component itself.

UPDATE: This comment fixes the problem.

from vuex-electron.

akodkod avatar akodkod commented on July 17, 2024

#44

from vuex-electron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.