Skip to content

Commit

Permalink
FIX batch updates trigger far too many updates in the store
Browse files Browse the repository at this point in the history
  • Loading branch information
Gsiete committed Mar 7, 2024
1 parent b747275 commit 4818923
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ function docChangeEvent(change, originalMeta = {}) {
};
}

const MAX_MULTI_ACTION = 15;
/**
* Dispatch action(s) response from listener response.
* @private
Expand Down Expand Up @@ -791,7 +792,7 @@ export function dispatchListenerResponse({
? docData.docChanges()
: docData.docChanges;
// Dispatch different actions for doc changes (only update doc(s) by key)
if (docChanges && docChanges.length < docData.size) {
if (docChanges && docChanges.length < Math.min(MAX_MULTI_ACTION, docData.size)) {

Check failure on line 795 in src/utils/query.js

View workflow job for this annotation

GitHub Actions / Build (16.x)

Replace `docChanges·&&·docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)` with `⏎····docChanges·&&⏎····docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)⏎··`

Check failure on line 795 in src/utils/query.js

View workflow job for this annotation

GitHub Actions / Build (18.x)

Replace `docChanges·&&·docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)` with `⏎····docChanges·&&⏎····docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)⏎··`

Check failure on line 795 in src/utils/query.js

View workflow job for this annotation

GitHub Actions / Build (20.x)

Replace `docChanges·&&·docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)` with `⏎····docChanges·&&⏎····docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)⏎··`
// Loop to dispatch for each change if there are multiple
// TODO: Option for dispatching multiple changes in single action
docChanges.forEach((change, index) => {
Expand Down

0 comments on commit 4818923

Please sign in to comment.