IjzerenHein / firestorter

Use Google Firestore in React with zero effort, using MobX 🤘
http://firestorter.com
MIT License
378 stars 50 forks source link

Using update in onTextChange #96

Closed zeevl closed 4 years ago

zeevl commented 4 years ago

Hey @IjzerenHein, I've been investigating this package and it seems like a great fit for our project!

One thing that has me concerned, though. Your example apps call update in onChangeText, which means the firebase update will be called for essentially every key press? Seems this could get expensive in text-heavy applications..

Am I understanding this correctly? I would love to see some sort of deferred update which changes the observable values, and with a subsequent flush to persist the changes to Firestore, called at some later point (i.e. blur). But I didn't want to dive into something like this if you had a different approach in mind.. (perhaps with #53?)

IjzerenHein commented 4 years ago

Hi! Well that's just an example, and it showcases how easy it can be to write some real-time updating code. I can very much imagine that you don't want to send an update action for every key-stroke though. In such a case I would just store the content in the state of your component and perhaps send it on accept or unmount. This is something that you would need to do yourself, or perhaps write an abstraction that handles this for you.

zeevl commented 4 years ago

Thought that might be the case. Thank you!