You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dd14e51
Browse filesBrowse the repository at this point in the historyBrowse files
zero-swift: port upstream's aggregate client tests, and rebase only for mutations from before a launch
Ports zero-client's aggregate-read-your-writes, group-read-your-writes,
crud-impl, custom, context, ivm-branch, keys and zero-poke-handler tests
of synced aggregates as JS-generated client scenarios (and an
`aggregate-row-key` vector), so Swift replays what JS does: read-your-writes
in both the optimistic and the rebase run, a distinct's new and removed
values, groupBy sum and avg creating a group, an orderBy-reordered group
key, an edit inside a group the client lacks, JSON path sums, null
correlations, row counts, junction aggregates, and source release.
Three scenarios showed Swift moving a synced group JS doesn't: the rebase
Swift runs when an aggregate first registers (standing in for the writes JS
persists for a pending mutation across a relaunch) also ran for mutations
made since launch, after the server dropped the query, or when a mutator's
read was the only reader. It now runs only while a mutation replayed at
launch is pending.
Co-authored-by: tmm <tmm@tmm.dev>
Amp-Thread-ID: https://ampcode.com/threads/T-01a19a37-5aa9-7256-bff5-cdc47c01a1fe
Copy file name to clipboardExpand all lines: .changeset/swift-synced-aggregates.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,4 @@
2
2
'zero-swift': patch
3
3
---
4
4
5
-
Aggregates, `distinct()` and `groupBy()` sync from zero-cache: a named query's view reads the rows the server computes, stored under `a/`, instead of dropping them from pokes. Until the server answers, a view computes nothing and shows the empty value (`0` for a count). A local mutation moves a synced relationship aggregate or grouped count at once, as the JS client's optimistic deltas do, and the server's rows replace them when it confirms. A mutator's `tx.run` reads the synced rows for a query the server has answered, and computes them otherwise. Pending mutations are rebased when a synced aggregate's query first materializes after launch, so a relaunched client keeps their moves.
5
+
Aggregates, `distinct()` and `groupBy()` sync from zero-cache: a named query's view reads the rows the server computes, stored under `a/`, instead of dropping them from pokes. Until the server answers, a view computes nothing and shows the empty value (`0` for a count). A local mutation moves a synced relationship aggregate or grouped count at once, as the JS client's optimistic deltas do, and the server's rows replace them when it confirms. A mutator's `tx.run` reads the synced rows for a query the server has answered, and computes them otherwise. While mutations made before a relaunch are pending, they are rebased when a synced aggregate's query first materializes, so the relaunched client keeps their moves.
0 commit comments