Make use of docChange of QuerySnapshot to pick changes #58
Description
Is there an option for react-firebase
to support delta change of QuerySnapshot
to cherry-pick and update only the affected documents (added, modified, deleted) in the local copy?
react-firestore
version: 1.0.1node
version: v8.16.0npm
(oryarn
) version: 1.19.1
Relevant code or config
The current FirebaseCollection.handleOnSnapshotSuccess()
is directly updating the state by replacing the data
in case of even minor updates of the collection.
What you did:
MUI-Datatable wrapped in FirebaseCollection and data
is shared between the components.
What happened:
Upon internal (from within the app) or external change of the data (another app user) the Datatable widget will re-render fully.
Problem description:
In case consumer widget is relying on state of data
the component must re-render fully breaking the flow unexpectedly. In my app the FirebaseCollection feeds MUI-Datatable and change of underlying data re-renders the full table and loosing the state of the table.
Suggested solution:
- Use
docChange()
and a different state management approach, useReducer
to delegate state management to consumer,- any other option?