question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Immediate mode: instant, synchronous document updates

See original GitHub issue

What 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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
puppybitscommented, Apr 15, 2021

@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.

1reaction
puppybitscommented, Feb 26, 2021

@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. ezgif-2-b71ab9e2110f

After. ezgif-2-acf3f960c486

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found