@devries-cameron20 / t3code Mirror · read-only / commits / 07cb902866
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 05:30 UTC

fix(web): a snoozed thread wakes in the open chat view (#21019)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 17, 2026 at 15:16 UTC 07cb90286656393e395192d82f5c9980b604ef31
1 file changed +16 -6
apps/web/src/components/ChatView.tsx
+16 -6
@@ -4751,25 +4751,35 @@ export default function ChatView(props: ChatViewProps) {
4751 const supportsSnooze = serverConfig?.environment.capabilities.threadSnooze === true;
4752 const supportsPinning = serverConfig?.environment.capabilities.threadPinning === true;
4753 const activeThreadPinned = supportsPinning && activeThreadShell?.pinnedAt != null;
4754 + // The compiler caches render results on their inputs, so a clock read in render
4755 + // stays frozen until the shell changes. The clock is state: reset with the shell,
4756 + // and moved by the wake timer.
4757 + const [snoozeClockState, setSnoozeClockState] = useState(() => ({
4758 + shell: activeThreadShell,
4759 + now: new Date().toISOString(),
4760 + }));
4761 + if (snoozeClockState.shell !== activeThreadShell) {
4762 + setSnoozeClockState({ shell: activeThreadShell, now: new Date().toISOString() });
4763 + }
4764 + const snoozeClock = snoozeClockState.now;
4765 const activeThreadSnoozed =
4766 activeThreadShell !== null &&
4767 supportsSnooze &&
4757 - effectiveSnoozed(activeThreadShell, { now: new Date().toISOString() });
4758 - const [snoozeWakeTick, bumpSnoozeWakeTick] = useState(0);
4768 + effectiveSnoozed(activeThreadShell, { now: snoozeClock });
4769 useEffect(() => {
4770 if (!activeThreadSnoozed) return;
4771 const wakeAtMs = Date.parse(activeThreadShell?.snoozedUntil ?? "");
4772 if (!Number.isFinite(wakeAtMs)) return;
4773 const id = window.setTimeout(
4764 - () => bumpSnoozeWakeTick((tick) => tick + 1),
4774 + () => setSnoozeClockState((clock) => ({ ...clock, now: new Date().toISOString() })),
4775 Math.min(Math.max(0, wakeAtMs - Date.now()) + 50, 2_147_483_647),
4776 );
4777 return () => window.clearTimeout(id);
4768 - // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A tick that lands before the wake time (timer clamping, clock skew) re-arms the timer.
4769 - }, [activeThreadShell?.snoozedUntil, activeThreadSnoozed, snoozeWakeTick]);
4778 + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A clock that lands before the wake time (timer clamping, clock skew) re-arms the timer.
4779 + }, [activeThreadShell?.snoozedUntil, activeThreadSnoozed, snoozeClock]);
4780 const activeThreadWokeAt =
4781 activeThreadShell !== null && supportsSnooze
4772 - ? threadWokeAt(activeThreadShell, { now: new Date().toISOString() })
4782 + ? threadWokeAt(activeThreadShell, { now: snoozeClock })
4783 : null;
4784 const acknowledgeThreadWoke = useAcknowledgeThreadWoke();
4785 const acknowledgeActiveThreadWoke = () => {