Comments (12)
@joshua1
What is the modulePath you passed for the vuex-easy-firestore module?
You could check and confirm your full store structure by console.logging it.
from vuex-easy-firestore.
i have something like this passed in
import Vuex from 'vuex'
import createEasyFirestore from 'vuex-easy-firestore'
import createEasyAccess from 'vuex-easy-access'
import {userModule} from './modules/user-module.js'
.....
const fireStorePlugin = createEasyFirestore(
[authModule, utilModule, userModule],
{ logging: true }
)
const easyAccessPlugin = createEasyAccess({
vuexEasyFirestore: true
})
const store={
plugins:[firestorePlugin, easyAccessPlugin]
}
const createStore = () => {
return new Vuex.Store(store)
}
export default createStore
where userModule was imported from user-module.js file with snippet like below
export const userModule = {
firestorePath: 'users/{userId}',
firestoreRefType: 'doc',
moduleName: 'user',
state: userState,
actions: userActions,
getters: userGetters
}
from vuex-easy-firestore.
Hey @joshua1
You should be able to do the one below from any module:
dispatch('user/openDBChannel', null, {root: true})
Can you try this? Don't forget, root is the third param.
Also, I have pushed a bug fix for vuex-easy-access yesterday. Can you just to be sure do:
npm i --save vuex-easy-access@latest vuex-easy-firestore@latest
from vuex-easy-firestore.
@mesqueeb no dice. didn't work
from vuex-easy-firestore.
@joshua1 Can you share you repo?
OR can you please tell me more about your store.
Do you ONLY have vuexEasyFirestore modules?
if not please: tell me your module structure for your store + all moduleName
paths for vuex-easy-firestore.
eg.
store = {
modules: {
user: {
modules: {
settings
}
}
modals: {
modules: {
menu
}
}
}
plugins: [vuexEasyFirestore]
}
Two vuexEasyFirestore modules, have these moduleName
s:
user/syncedData
someOtherModule
Then it's easy to understand for me what action you are trying to trigger from what module.
from vuex-easy-firestore.
@joshua1 Also try to do console.log(this)
inside a vuex action then check which actions exist there.
from vuex-easy-firestore.
@joshua1
you really should be able to do dispatch('user/openDBChannel', null, {root: true})
from anywhere. I can not think of a single reason this would not work. Do you get an error? If so, please tell me which error.
from vuex-easy-firestore.
@mesqueeb thanks a lot for your assistance. my store is a mix of vuexEasyFirestore modules and vuex modules that have no firestore persistence, i am also using vuexeasyaccess plugin.
this dispatch('user/openDBChannel')
works from the root store , but every dispatch call (within the store) with '/set/' gives the error down below.
i don't get as far as being able to find what console.log(this) in a module action is because i get this error in browser on application start
webpack-internal:///./node_modules/vuex/dist/vuex.esm.js:637 [vuex] unknown local action type: user/set/, global type: user/user/set/
this is because i have a
dispatch('user/set/', userData)
inside an auth.onAuthStateChange subscription block to set the stores user data.This is even inside the user module as {root:true} wasn't working
I have read the documentation end to end not sure if the dispatch calls using '/set' works only when used outside the store as a whole .
I am currently exploring rxFire from firebase , might just work in my case and save me the time.
Thanks a great deal
from vuex-easy-firestore.
@joshua1
Looking at your error:
unknown local action type: user/set/, global type: user/user/set/
seems like you are trying to dispatch an action to 'user/set'
from within the user module, causing it to look for a sub-module called user inside the user module (which doesn't exist).
I believe that your problem is more related to general "how to work with vuex" and is not a problem with my library.
That being said, I'd love to help out so I can understand what it is exactly what you are doing wrong.
Can you please email me your repository so I can have a look? My email is [email protected]
Or if you can install Telegram or Twitter send me a personal message at 'mesqueeb', I think it will be easier if we can chat to find the problem in your code.
from vuex-easy-firestore.
I believe that your problem is more related to general "how to work with vuex" and is not a problem with my library.
I have shipped a good number of vue projects using vuex, this isn't my first rodeo. The statement i made here I have read the documentation end to end not sure if the dispatch calls using '/set' works only when used outside the store as a whole
is close to what i get. it works if i make this dispatch calls from the base store and not from any of the modules. its fine i can work with that.
from vuex-easy-firestore.
@mesqueeb i was able to get it working, had to make all my modules firestore modules (by adding the vuex-easy-firestore specific properties ), which implies that i have to remove all state properties using guard
from vuex-easy-firestore.
@joshua1 it's just weird since I never had the problem that you are facing. And i'm not sure what is causing it. I feel sad that you had to try so many things. But i'm also glad you got it working.
If you do ever are able to share your code I would love to take a look. Maybe I can find out where the problem was and make sure other people don't have to face this as well.
from vuex-easy-firestore.
Related Issues (20)
- cannot read resolve of undefined HOT 7
- Feature: Add firestore.getAll() on the web HOT 7
- Question: can we rely on the `signedIn` getter to check if the user is signed in? HOT 3
- Guard 'id' will still add 'id' on update HOT 1
- Reacting to changes in vue-router HOT 1
- Retrieve subcollections together with document HOT 2
- feat(docs): add firestore guide
- RangeError: Maximum call stack size exceeded HOT 6
- ProjectId not provided in firebase.initializeApp despite being provided HOT 3
- Can't get it to work no matter what! HOT 6
- Two-way binding HOT 4
- Getters undefined when working with users collection + sign in onAuthStateChanged [Help]
- fetch only returns id in doc HOT 2
- Update library for firebase v9 HOT 3
- Adding "in" or "array-contains" to the where clause
- setPathVars should be better documented HOT 1
- Doc insertion from multiple apps at he same index
- project build process HOT 1
- E2E test with Cypress
- syncStack / rejects HOT 1
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-easy-firestore.