Skip to content

feat(db): allow externally-provided previousValue in sync update chan…#1445

Open
SamJB123 wants to merge 2 commits intoTanStack:mainfrom
SamJB123:main
Open

feat(db): allow externally-provided previousValue in sync update chan…#1445
SamJB123 wants to merge 2 commits intoTanStack:mainfrom
SamJB123:main

Conversation

@SamJB123
Copy link
Copy Markdown

@SamJB123 SamJB123 commented Apr 2, 2026

🎯 Changes

This change allows consumers the option of providing direct previousValue inputs, improving integration with other sync engines such as Yjs v14, without affecting standard behavior.

When collection values are live-reading proxy objects (e.g. Yjs Y.Type proxies via getAttr()), deepEquals(previousVisibleValue, newVisibleValue) always returns true — both sides read through the already-mutated proxy and see identical current values. First updates on proxy-backed rows are silently dropped.

ChangeMessage already has an optional previousValue field, and sync sources like Yjs deltas already know the pre-mutation state (SetAttrOp.prevValue). This change lets commitPendingTransactions use a sync-provided previousValue for the comparison instead of the captured currentVisibleState, which is unreadable when the value is a live proxy.

When previousValue is not provided, behavior is unchanged.

✅ Checklist

  • [✅] I have tested this code locally with pnpm test.
  • [✅] I have tested this code in runtime implementations using yjs v14 successfully.

🚀 Release Impact

  • [✅] This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

SamJB123 added 2 commits April 2, 2026 23:20
…ge detection

When collection values are live-reading proxy objects (e.g. Yjs v14 Y.Type proxies via getAttr()), deepEquals(previousVisibleValue, newVisibleValue) always returns true — both sides read through the already-mutated proxy and see identical current values. First updates on proxy-backed rows are silently dropped.

ChangeMessage already has an optional previousValue field, and sync sources like Yjs deltas already know the pre-mutation state (SetAttrOp.prevValue). This change lets
  commitPendingTransactions use sync-provided previousValue for the comparison instead of the captured currentVisibleState, which is unreadable when the value is a live proxy.

When previousValue is not provided, behavior is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant