Repository navigation
fix(web): the sidebar and family tabs file threads on one clock - #1022
Merged
Merged
Conversation
Every useInboxThreads caller started its own 30-second clock, so the sidebar and the family tabs read the time at different moments. Right when a finished child left its parent's family, a sidebar row and its tab could disagree on membership and on the child's short label for up to 30 seconds. useInboxThreads now reads useSharedTimeTick: one clock per interval for every caller. It ticks only while something reads it, a reader that mounts after a quiet spell gets the time now, and a late tick (a sleeping computer, a background tab) catches up at the first read and tells every reader together. Time labels keep useRelativeTimeTick, which starts fresh on mount.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
Every
useInboxThreadscaller started its own 30-second clock, so the sidebar and the family tabs read the time at different moments. Right when a finished child left its parent's family, a sidebar row and its tab could disagree on membership and on the child's short label for up to 30 seconds.useInboxThreadsnow readsuseSharedTimeTick, one clock per interval shared by every caller (auseSyncExternalStorestore):Time labels like "5m ago" keep
useRelativeTimeTick, which starts fresh when it mounts. A shared clock there could make a just-sent message read as sent in the future.Tests: three fake-timer tests for the shared clock (a reader that joins mid-interval reads the same time, the clock stops when unread, a late tick catches up for every reader). Full web unit suite and the sidebar and chat browser tests pass.