Skip to content

Commit a6822af

Browse files
committed
Fix DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE reordering detection
1 parent 90653da commit a6822af

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/graph/src/-private/-diff.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,21 @@ function _compare<T>(
235235
// we can disregard the change notification generation so long as
236236
// we are not configured to reset on remote update (which is deprecated)
237237
if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {
238-
if (!remoteClearsLocal && i < priorLocalLength) {
238+
if (i < priorLocalLength) {
239239
const priorLocalMember = priorLocalState![i];
240-
if (priorLocalMember !== member) {
240+
if (remoteClearsLocal) {
241+
if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {
242+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
243+
!changed && console.log(`changed because member !== prevMember && remoteClearsLocal`);
244+
}
245+
changed = true;
246+
} else if (priorLocalMember !== member) {
247+
if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {
248+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
249+
!changed && console.log(`changed because priorLocalMember !== member && member !== prevMember`);
250+
}
241251
changed = true;
242252
}
243-
} else {
244-
changed = true;
245253
}
246254
} else {
247255
if (i < priorLocalLength) {

0 commit comments

Comments
 (0)