Immediate mode: instant, synchronous document updates
See original GitHub issueWhat is the feature? When doing something like drag and drop the updates to firestore take too long so the UI jumps. This is even worse with transactions.
What version would this apply to? v0.15
Do you have thoughts/examples on how the feature would be used (i.e. API)?
Yes. I already forked it and made it work: https://github.com/TARAAI/redux-firestore/pull/1
// Single document change w/ synchronous, optimistic data in Redux
firestore.mutate({ collection: 'collection/path', doc: 'document-id', someChange: 'value' });
// Batch multiple document changes w/ synchronous, optimistic data in Redux
// (batches > 500 will be bundled and committed together)
firestore.mutate([
{ collection: 'collection/path', doc: 'document-id', someChange: 'value' },
{ collection: 'collection/path', doc: 'other-id', otherChange: 'otherValue' }
]);
// transactions w/ synchronous, optimistic data in Redux
firestore.mutate({
read: {
myLockedDocument: {
collection: 'path',
doc: 'document-id',
}
},
write: [({ myLockedDocument }) => ({
collection: 'path',
doc: 'document-id' ,
someNumber: myLockedDocument.someNumber + 10
})]
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Immediate mode: instant, synchronous document updates
Immediate mode : instant, synchronous document updates. ... When doing something like drag and drop the updates to firestore take too long so...
Read more >Sync files with OneDrive Files on Demand - Microsoft Support
With OneDrive Files On-Demand, you can: Save space on your device by making files online only. Set files and folders to be always...
Read more >In-app updates - Android Developers
Immediate updates are fullscreen UX flows that require the user to update and restart the app in order to continue using it. This...
Read more >Soft Updates: A Technique for Eliminating Most Synchronous ...
synchronous writes to sequence dependent metadata updates or by using write-ahead logging to ... immediate crash recovery (fsck not required for safe.
Read more >Starting Backup Copy Jobs Manually - User Guide for VMware ...
This procedure differs for the periodic and immediate copy modes. ... In the working area, select the backup copy job and click Sync...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@prescottprue Submitted a PR for this new reducer. The headline is that is’ 100x faster for all changes.
The reason is that even single save operations have to round-trip over the network before the snapshot listener fires. For us saving a Firestore transaction in production took a minimum of 1.2s to show the results to the user. That dropped to 6ms. That’s over 100x faster.
@prescottprue I’ve updated our fork and integrated it into our app. Here’s an illustration of the issue and the difference between the 2 different reducers.
Before.
After.
We’re doing internal QA on our app but when it all passes we’d be happy to send a PR.
It does handle both success and failure cases when the firestore save reaches a resolution. Here’s a link to our internal PR review to see the details https://github.com/TARAAI/redux-firestore/pull/4.
Also we have an additional follow-on feature planned which would unify single document changes, batches, transactions and optimistic updates into a single API call so manually sending an optimistic update would no longer be needed.