Skip to content

Immediate mode: instant, synchronous document updates #323

Open
@puppybits

Description

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: Optimal-AI#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
    })]
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions