Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable synchronization #261

Open
louisameline opened this issue Nov 14, 2019 · 7 comments
Open

Disable synchronization #261

louisameline opened this issue Nov 14, 2019 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@louisameline
Copy link
Collaborator

Hello, I'm eventually trying out the library, thanks for your work!
I have a list of feedback for later, but this is my actual first question :)

In my app, I don't sync the store at all until the user has signed up.
What is the recommended way to to tell the library to not attempt any kind of sync until then?
Thank you!

@mesqueeb
Copy link
Owner

mesqueeb commented Nov 14, 2019

@louisameline heyyy I'd recommend firebase Auth anonymous users. These are great because you can upgrade them later and the user won't loose their data ! ;)

Orrr don't initialise Firebase yet ? But actually I never tried this so I'm not sure I have good advice. I'd need to sit down and think about this can be done.

@louisameline
Copy link
Collaborator Author

louisameline commented Nov 14, 2019

Thanks for the quick answer!

Free users have their data saved on the device only, I tell them to upgrade to have it saved in the cloud ;) Also I do not not want to pay Firestore fees for free users, so I will need an on/off switch.

As a sidenote, I need to finish a first version of my app, then help you as much as I can with this library. I think it has the right approach and should be the default choice for anyone using Vuex and Firestore. I'll discuss more when I open a bunch of issues to share ideas :) Thank you

@scriptPilot
Copy link

I did it this way ...

Firebase.auth().onAuthStateChanged(user => {
  if (user) {
    store.commit('module/openDBChannel')
  } else {
    store.commit('module/closeDBChannel')
  }
})

@mesqueeb
Copy link
Owner

@scriptPilot even though the DB is closed, set, insert, patch are still executed via the Firestore SDK as well.

This is because openDBChannel is only about "reading" data, not writing.

@louisameline
I guess I could make a simple action you can dispatch to stop and start writing data.

Sent with GitHawk

@louisameline
Copy link
Collaborator Author

louisameline commented Nov 17, 2019

I came to the same conclusion: an action, which makes it possible to enable certain modules (say the user's personal informations) while others stay inactive (say some data backupper). I think a module option to make the module inactive at startup until explicit activation will be needed as well.

@louisameline louisameline added the enhancement New feature or request label Dec 6, 2019
@louisameline louisameline added this to the v2.0 milestone Dec 6, 2019
@Gnopps
Copy link
Contributor

Gnopps commented May 20, 2021

@louisameline How did you eventually solve this? I'm looking for the same right now:

  1. Unregistered user => Store locally only
  2. Registered user => Use firestore

@louisameline
Copy link
Collaborator Author

I have a function that calls the vuex methods directly instead of easy-firestore if the user is not logged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants