From 9e14e00170e03ac9e9a8498d18e65dbed9624c17 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 24 Sep 2025 16:29:50 -0400 Subject: [PATCH] Revert onUpdateByOthers change --- .changeset/swift-lemons-rule.md | 5 +++++ packages/client/src/index.js | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 .changeset/swift-lemons-rule.md diff --git a/.changeset/swift-lemons-rule.md b/.changeset/swift-lemons-rule.md new file mode 100644 index 000000000..5cca8166f --- /dev/null +++ b/.changeset/swift-lemons-rule.md @@ -0,0 +1,5 @@ +--- +'contexture-client': patch +--- + +Revert onUpdateByOthers change diff --git a/packages/client/src/index.js b/packages/client/src/index.js index b13baf3ba..93f4244fc 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -134,13 +134,14 @@ export let ContextTree = _.curry( _.map(snapshot), _.find({ path: snapshot(event.path) }) )(updatedNodes) - 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 (!affectsSelf) + await Promise.all( + _.map((n) => { + // When updated by others, force replace instead of merge response + extend(n, { forceReplaceResponse: true }) + runTypeFunction(types, 'onUpdateByOthers', n, actionProps) + }, 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