perf(bindx-react): batch list refresh notifications - #111
Open
matej21 wants to merge 4 commits into
Open
Conversation
- A throwing subscriber no longer drops the rest of a flush. Delivery finishes, then the first subscriber error propagates and the rest are logged. When the batch callback itself throws, its error wins. - Queued keys move with their subscribers on rekey, so a flush no longer reads the redirect map, which clear() does not reset. - batchNotifications rejects async callbacks at compile time. - Rows under a shared ancestor walk it once per batch. The walked set is reset whenever a relation write changes the edges. - applyJournalImages and importPartialSnapshot run in a batch: an undo that removes K creates notifies once, after the restore completes. - notifyGlobal() is removed; it was identical to notify(). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrj6jnat2NHRCAR4vgmWk
Each of these wrote row by row and sent one global notification per row, so every mounted usePersist ran a dirty scan per row: - HasManyDataGrid page loads - BatchPersister claim, post-persist reconciliation, and release + sweep - EntityLoader.loadMany - useEntity: refreshed data and the success state now arrive together List and grid rows are validated before any write, without `as` casts; a row without a string id now fails the load. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrj6jnat2NHRCAR4vgmWk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A production performance trace showed repeated dirty-state scans taking about 635 ms of an 801 ms main-thread task. Each row in a list response dispatched a server refresh and synchronously notified global subscribers;
usePersistthen scanned the store again for each row.Changes
SnapshotStore.batchNotifications, backed by the subscription manager.finally; batching does not introduce rollback or change undo transaction boundaries.Validation
The trace identifies the removed source of repeated work; end-to-end browser speed after this change has not yet been measured.