Skip to content

fix(web): the sidebar and family tabs file threads on one clock - #1022

Merged
badcuban merged 1 commit into
mainfrom
fix/shared-inbox-clock
Nov 20, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/shared-inbox-clock

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

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 shared by every caller (a useSyncExternalStore store):

  • It ticks only while something reads it.
  • A reader that mounts after a quiet spell gets the time now, so the shared time is never older than one interval.
  • A late tick (a sleeping computer, a background tab) catches up at the first read and tells every reader together.

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.

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.
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 20, 2026 6:33pm UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 847dde5 Nov 20, 2026
23 checks passed
@badcuban
badcuban deleted the fix/shared-inbox-clock branch November 20, 2026 18:50

This branch was previously deployed

1 inactive deployment
Preview — f4b52c59 Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant