LegendApp / legend-state

Legend-State is a super fast and powerful state library that enables fine-grained reactivity and easy automatic persistence
https://legendapp.com/open-source/state/
MIT License
2.73k stars 81 forks source link

Firebase & Firestore Plugins #5

Open hirvesh opened 2 years ago

hirvesh commented 2 years ago

Hello ๐Ÿ‘‹

A508CD9A-B807-406D-98F2-07A9A8C5171C

Just read this and would appreciate to know how far along the Firebase/Firestore plugins are.

Can you shed light on how it will work and if it will support both Firebase JS SDK on web (v8 and/or v9) and react-native-firebase on the native side?

Keep up the good work, youโ€™re legends ๐Ÿ˜

jmeistrich commented 2 years ago

We have a Firebase Realtime Database plugin that we use for the sync system in Bravely and will use in Legend soon, but it's still in active development and not quite cleaned up for everyone to use.

It has a lot of complexity with offline caching, supporting saving/querying by timestamp, automatically shortening field names to a single character, etc... I'm not sure how much of that would be applicable to most developers, so we may want to remove some of the complexity for the open source version to be more approachable? Or otherwise it needs more cleaning up to make friendlier.

If a lot of people are interested in it, we could try to prioritize open sourcing it in its current (or slightly more cleaned up) state.

If you're able to share, it would be helpful to know how you generally structure your Firebase data so that the plugin can be more general purpose

The Firestore one is only a plan at this point. Maybe once we open up the Firebase plugin someone could make a similar plugin for Firestore?

And it does support both the JS SDK and react-native-firebase. It has a setFunctions to pass in the basic functions it uses. It's designed around the v9 api but you could probably massage the v8 api into it to make it work.

ansh commented 1 year ago

Would really appreciate this update!

jmeistrich commented 1 year ago

Just a quick status update: the firebase plugin is close to complete but heavily in flux as Bravely is getting close to a release. Some of the recent updates here to persistObservable and the new trackHistory feature were built for that. Once we finish the Bravely release, we'll do a bit of cleanup and move the firebase sync plugin into this repo :). Hopefully that will be within a couple of weeks.

superstem123 commented 1 year ago

Just a quick status update: the firebase plugin is close to complete but heavily in flux as Bravely is getting close to a release. Some of the recent updates here to persistObservable and the new trackHistory feature were built for that. Once we finish the Bravely release, we'll do a bit of cleanup and move the firebase sync plugin into this repo :). Hopefully that will be within a couple of weeks.

Can't wait to try it out. Thanks.

raymclee commented 1 year ago

would love to try it any soon

raymonddaikon commented 1 year ago

The trackHistory feature sounds interesting, how are you guys handling the diffs? Maybe porting that feature over first may be a good first step?

jmeistrich commented 1 year ago

@raymonddaikon trackHistory is already available (docs). And it's actually pretty simple (source).

I should probably update about the Firebase plugin as it's been a while! We're focused now on releasing the update to Legend that uses the new sync system, then we'll clean up and document the plugin and release it here. I'm hoping that should be within the next few weeks.

raymonddaikon commented 1 year ago

Awesome! Looking forward to seeing how you guys are handling crdt, I'm currently manually creating diff patches with jsondiffpatch and patching/unpatching my state tree to go through the undo and redo stack