-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
A bunch of ideas for improvement #265
Comments
@louisameline thank you so much for this wonderful list of improvements.
You're right on these! I'll improve the docs: #266
I don't have any experience with vuex-persist. So feel free to PR the docs for this one ;)
Sadly, Vuex actions only allow for 1 single parameter. And thus my reasoning is this:
I hope you now understand my reasoning. Feel free to continue the discussion on this point ;)
I think you are confusing duplicate with another action perhaps. As you can see here, I return an
We can think of better names for Perhaps we can rename it to
Ah, good old pagination... 😃 pagination needs a lot of thinking. Something like
Maybe I should rephrase my statement slightly, but I think this is veery dangerous territory... 😅 Thanks for the heads up though!
As you know, I plan to completely change the syntax to something that's closer to functional programming or the composition api of vue 3, where you'd only import the functions you want to use and avoid polluting anything. I am still thinking about how to best create my library's internal state like
This one is hard, because it depends on your style. Let me give you an example:
It's just preference of how you would want to do it, and I'm sure I can please more devs by allowing both methods. BUT I do agree it can use some improvement by either making the docs clearer or the improve the syntax of how you pass the config of a v-e-f module.
EasyFirestore options of a module are re-grouped under the
Not only error handling, but also the fact there's an automatic initial doc insertion on doc mode, is currently a big mess... 😅
You are right. Another doc improvement: #226
My reasoning for this was that the Firestore SDK uses
yep... good catch 😉 #267
aha! clever thought! You're completely right!! But I think I'm thinking of importing actions directly onto the modules for v2, so perhaps a breaking change that might not be worth it anymore for v1. 😢
WHAT!? 🙉 Very strange... 🧐 I cannot believe why that wouldn't work. It should work lol.
Are you sure...? function init () {
Firebase.auth().onAuthStateChanged(user => {
if (user) return store.dispatch('auth/onSignin', user)
store.dispatch('auth/onSignout')
})
}
if (window && window.cordova) {
document.addEventListener('deviceready', init, false)
} else {
init()
} |
@louisameline I just wanna conclude to say that I love all your suggestions! Keep them coming while you're working more with the library!! I look forward on working on V2 with you 😉 |
Thanks for the fast answer!
I see, so you didn't want an object, fair enough!
I meant "object", not "array", but yes you got my point :)
As the name suggests, it just saves your state locally one way or the other, so you can get it back next time you load the app. Great to save a lot of Firestore calls. I might have more to tell about this in another issue later in case of need ;)
We actually agree I think, I meant that "fetch" is just a fetch, and "pull" is fetch+add (like pull = fetch+merge in Git). But "get" instead of "pull" is perfectly fine too.
Sure, it's a question of preference! I probably wouldn't advertise it as a default way of doing things, but why not.
I wasn't clear enough here, I was referring to
Yes,
Yes that's what I am referring to. Firebase needs to wait for
Thanks again! |
I'll close this issue now as everything is going to be addressed in the next version one way or the other |
Hello,
First of all, thanks for your work, the library looks good!
Since you asked for feedback to the community, here is a list of things I'd improve so far, in no particular order. Feel free to ask for details is something is not clear enough.
vuex-persist
: I'd recommend to set the minimal size possible (1Mo) in Firestore's persistence options, because otherwise the data is persisted twice (hence less storage space). It should not be completely disabled though because it allows Firebase retries in case of failure.dispatch('myModule/delete', '${id}.tags.water')
wasdispatch('myModule/delete', id, 'tags.water')
, using a template in a function argument is cumbersome for no obvious reasondispatch('pokemonBox/duplicate', '001')
currently returns an object, but it should return a string for consistency with other actions. On the other hand,dispatch('pokemonBox/duplicate', ['001'])
should return an array. Makes sense?fetch
actions could renamed for clarity. I suggest that collections could have apullCollection()
(instead offetchAndAdd
) and apullDocument(id)
(instead offetchById(id)
actions. Document should have just thepullDocument()
action. I usepull
to diffentiate from a potentialfetchCollection
for collections, similarly to Git's vocabulary.dispatch('myModule/fetchAndAdd')
several times in a row for pagination is awkward, something like a.more()
method would be nice. I briefly reviewed a library called Fiery a few days ago, it could be an inspiration (or even used by Easy Firestore)statePropName
. I would rather advise not to use one, and keep the data you don't want to synchronize in a "local" module which won't be synced. Also, this feature is redundant with the fact that guards exist to prevent some properties to be synced. If it were me, I'd probably remove thisstatePropName
and add an option that would say "Do not sync properties that start with an underscore", which would be an easy and obvious way to exclude props without the need of guards..catch(error => { if (error === 'preventInitialDocInsertion') })
in the doc. Please usenew Error('my text')
to return an error. You return a string, others will return an object, others an array... The only sensible and consistent thing to do is to use Errors, they exist for thatenablePersistence
, which does not garantee at all that you'll get your initial data right. It's rather upon the failure ofopenDBChannel
or an initial fetch that we need to suspend the app.firestoreRefType: 'doc'
: as a rule, I try to not use diminutives, so I'd use the proper word "document" through the whole app, but that's a personal preference maybestatePropName
cannot be set tonull
, you currently have to set an empty string. I've seen this in other places too. This is an unexpected because as a general rule, the absence of a value should be represented bynull
. Only in very rare cases empty strings should be used.VuexEasyFirestore([myModule])
. This would remove the need formoduleName
in the module. That's the way Vuex works, and in general module don't need to name themselves.deviceReady
option. Maybe (I'm not sure about this) we should be able to pass a promise to the library and it would be smart enough to not make the xhr calls and queue them until the promise is fullfilled. But that's a bonus, not a priorityI'll stop for now. I have just started implementing the library actually, I'll probably have other thoughts later if you're interested. Please let me know what you think, so I know if we would be pushing the library in the same direction if I had time to contribute a little.
Thanks !
The text was updated successfully, but these errors were encountered: