Skip to content

Commit 14dcdbe

Browse files
authored
Merge pull request #276 from smartprocure/feature/call-onUpdateByOthers-after-results
Revert some changes
2 parents 3a91ee4 + c1fd965 commit 14dcdbe

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

.changeset/mighty-crabs-pretend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'contexture-client': patch
3+
---
4+
5+
Revert back to running onUpdateByOthers before running the search

packages/client/src/index.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,13 @@ export let ContextTree = _.curry(
134134
_.map(snapshot),
135135
_.find({ path: snapshot(event.path) })
136136
)(updatedNodes)
137-
if (!affectsSelf)
138-
await Promise.all(
139-
_.map((n) => {
140-
// When updated by others, force replace instead of merge response
141-
extend(n, { forceReplaceResponse: true })
142-
}, updatedNodes)
143-
)
144-
145-
for (const n of _.remove({ path: snapshot(event.path) }, updatedNodes)) {
146-
extend(n, { wasUpdatedByOthers: true })
147-
}
137+
await Promise.all(
138+
_.map((n) => {
139+
// When updated by others, force replace instead of merge response
140+
extend(n, { forceReplaceResponse: true })
141+
runTypeFunction(types, 'onUpdateByOthers', n, actionProps)
142+
}, _.remove({ path: snapshot(event.path) }, updatedNodes))
143+
)
148144

149145
// If disableAutoUpdate but this dispatch affects the target node, update *just* that node (to allow things like paging changes to always go through)
150146
// 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(
232228
else {
233229
target.forceReplaceResponse = false
234230
extend(target, responseNode)
235-
if (target.wasUpdatedByOthers) {
236-
delete target.wasUpdatedByOthers
237-
runTypeFunction(types, 'onUpdateByOthers', target, actionProps)
238-
}
239231
}
240232
if (debug && node._meta) target.metaHistory.push(node._meta)
241233
}

packages/client/src/node.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export let internalStateKeys = [
3030
'onMarkForUpdate',
3131
'afterSearch',
3232
'forceReplaceResponse',
33-
'wasUpdatedByOthers',
3433
'expand',
3534
'collapse',
3635
]

0 commit comments

Comments
 (0)