Document the live data layer and the realtime contract - #25
Merged
Conversation
The README still described the previous design — a row-data-free ping on a public channel with "refetch on each ping" — which is both gone and, as app guidance, the pattern that made rows pop in and out. Replaces it with what callers actually use (useEntity), what happens underneath (row-bearing private channels, gateway-minted tokens), and the notes that prevent the mistakes real apps hit: keep the bootstrap import, render the hook's data directly, don't layer your own optimistic state, and batch high-frequency input instead of writing per input event. Clarifies the term that misleads everyone: "private" means token-gated, not login-gated. A public app with no accounts gets a token for every visitor. AGENTS.md gains a realtime section pointing at the platform repo's architecture doc, plus the four traps that are easy to walk back into. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The README described the previous realtime design — a row-data-free
{table, op}ping on a public channel, with "refetch on each ping" as the app pattern. That channel no longer exists, and that pattern is specifically what made rows pop in and out.Replaced with:
useEntity— what callers actually use, with the mutation surface./lib/supabasebootstrap import, renderdatadirectly (don't mirror it intouseState), don't add your own optimistic layer, and batch high-frequency input (a drawing app writing perpointermoveis ~60 requests/second)postgres_changesdoesn't work on gateway-era apps — stated explicitlyAGENTS.mdgains a realtime section pointing at the platform repo's architecture doc plus the four traps that are easy to reintroduce.Docs only — no code change.