Repository navigation
feat(realtime): useRecordChanges — hear that records moved, holding none; useChannel().error() - #857
Merged
Merged
Conversation
…one; useChannel().error() A whole-type useRecords was the only way to react to a channel's records, and it holds the type: every row kept for the reader's life. The new hook gets the moved keys per type per store update and holds nothing; it is follow-only, so its island is not held behind the restore. useChannel's accessor now exposes the node's refusal of a failed membership. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts ceiling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🟡 Reviewed1 actionable comment(s) · grounded on your code ⏱ 1m 03s wall clock · 🤖 developerz.ai — automated review, running on your model and your box. |
Contributor
There was a problem hiding this comment.
Review summary — 9 file(s), 1 finding(s).
Critical 0 · Major 0 · Minor 1 · Nit 0
Completed [bot]: the refusal test does not protect the new reactive error contract.
1 non-blocking finding (1 minor; not posted inline)
packages/realtime/src/use-channel.test.ts:103test [bot] These imperative reads still pass iferror()stops readingversion(), leaving components that render only the refusal unable to update. Add a reactive-effect test that observeserror()before delivery and asserts it reruns withX_TOPIC_FORBIDDENafterward.
🤖 developerz.ai review — automated, running on your model and your box. What is this? · Reviewed by router/gpt-6.1-sol on box hv-dedicated-reviewer-1 — 187k in / 504 out over 3 calls; cost unknown: no price on record for router/gpt-6.1-sol.
Merged
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.
What
useRecordChanges(types, listener): one call per store update with the moved keys grouped by type. Holds no row and no type, so a page that re-renders on a channel'srecordspins nothing. Added toFOLLOW_ONLY_EXPORTS: it renders nothing from the store, so its island is never held behind the restore.useChannel(...).error(): the node's refusal of afailedmembership, read reactively.Why
tesote/marketing's header island held 11 types via
useRecords(type, {})only to learn that something changed, so every row stayed for the tab's life. It also couldn't tell a signed-outX_TOPIC_FORBIDDENfrom other failures, so it probed with an HTTP call.Not done (deliberately)
I did not add LRU eviction of never-held synced rows. Query adoption retains after adopting, disk-restored rows are unheld until islands mount, and mutator replays read whole types, so an inline cap could evict a row a render is about to retain. That needs its own design.
Tests
use-record-changes.test.ts(new): grouping, removal, holds nothing (eviction still happens), release.use-channel.test.ts: error() on refusal.bun test packages/realtime+ island-realtime suites: 0 fail.verify --only typecheck,lint,boundaries,filesize,errors,manifestgreen.🤖 Generated with Claude Code