diff --git a/.changeset/mighty-crabs-pretend.md b/.changeset/mighty-crabs-pretend.md new file mode 100644 index 000000000..28668b4d9 --- /dev/null +++ b/.changeset/mighty-crabs-pretend.md @@ -0,0 +1,5 @@ +--- +'contexture-client': patch +--- + +Revert back to running onUpdateByOthers before running the search diff --git a/packages/client/src/index.js b/packages/client/src/index.js index f806395eb..b13baf3ba 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -134,17 +134,13 @@ export let ContextTree = _.curry( _.map(snapshot), _.find({ path: snapshot(event.path) }) )(updatedNodes) - if (!affectsSelf) - await Promise.all( - _.map((n) => { - // When updated by others, force replace instead of merge response - extend(n, { forceReplaceResponse: true }) - }, updatedNodes) - ) - - for (const n of _.remove({ path: snapshot(event.path) }, updatedNodes)) { - extend(n, { wasUpdatedByOthers: true }) - } + await Promise.all( + _.map((n) => { + // When updated by others, force replace instead of merge response + extend(n, { forceReplaceResponse: true }) + runTypeFunction(types, 'onUpdateByOthers', n, actionProps) + }, _.remove({ path: snapshot(event.path) }, updatedNodes)) + ) // If disableAutoUpdate but this dispatch affects the target node, update *just* that node (to allow things like paging changes to always go through) // The assumption here is that any event that affects the target node would likely be assumed to take effect immediately by end users @@ -232,10 +228,6 @@ export let ContextTree = _.curry( else { target.forceReplaceResponse = false extend(target, responseNode) - if (target.wasUpdatedByOthers) { - delete target.wasUpdatedByOthers - runTypeFunction(types, 'onUpdateByOthers', target, actionProps) - } } if (debug && node._meta) target.metaHistory.push(node._meta) } diff --git a/packages/client/src/node.js b/packages/client/src/node.js index 678745c83..5f22b2015 100644 --- a/packages/client/src/node.js +++ b/packages/client/src/node.js @@ -30,7 +30,6 @@ export let internalStateKeys = [ 'onMarkForUpdate', 'afterSearch', 'forceReplaceResponse', - 'wasUpdatedByOthers', 'expand', 'collapse', ]