Adapt to it
I am a learner and an explorer sharing my journey here on Hashnode. Please reach out if you like my work let's have a chat about it
Markdown supported · ⌘↵ to post
There is a lifecycle issue in the sample that would work against the snapshot-plus-delta design: getKey is an inline function in LiveActivityContainer, while the hook includes getKey in its effect dependencies. Each setData update rerenders the component, creates a new function and can close and reopen the socket.
I would give that key extractor a stable identity and add a test asserting that several incoming updates keep one connection open. Otherwise a healthy event stream can produce its own reconnect churn, even after removing every router.refresh call. That is separate from deduplicating the initial snapshot.
Yagya Goel
Awesome breakdown. RSCs definitely felt like a magic bullet at first, but separating out the real-time layer makes total sense. Great read