You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resume Concierge trickle on revisit instead of restarting
Anchor the trickle's start time to displayAfter rather than mount time so
navigating away and back resumes the reveal at the wall-clock-correct
stage. Past the 60s hard cap, drop the optimistic since the canonical
reportComment is expected to be in REPORT_ACTIONS by then.
Also handle a previously-missed race: if the canonical reportComment is
already present on mount (or lands during the pre-trickle setTimeout
window) the hook now discards the optimistic instead of completing
naturally and clobbering the canonical.
Reported in PR 89146 review comment 4352563004.
/** If displayAfter is more than this far in the past, the response is stale (e.g. app was killed and restarted). */
15
-
constSTALE_THRESHOLD_MS=10_000;
16
14
/** Default trickle duration. Targets ~19 chars/sec start (~7/sec end after ease-out) across a typical multi-paragraph response — visibly streaming without dragging the user past the moment they want to read. */
17
15
constDEFAULT_STREAM_DURATION_MS=15_000;
18
16
/** Trickle tick cadence. 80ms targets ~1 char per tick at char-level granularity — fast enough that the reveal feels continuous, slow enough that the synthetic-bubble re-render budget stays comfortable on RNW (~12 dispatches/sec). */
19
17
constTICK_INTERVAL_MS=80;
20
-
/** Hard cap on running trickle. If the loop is still alive past this, force completion to avoid pinning a synthetic bubble forever. */
18
+
/** Hard cap on a running trickle and staleness gate on revisit. Past this many ms after `displayAfter`, the canonical reportComment is expected to be in REPORT_ACTIONS already, so we discard the optimistic rather than resume a doomed reveal. */
21
19
constTRICKLE_HARD_CAP_MS=60_000;
22
20
/** Once the real reportComment lands in REPORT_ACTIONS, finish the remaining reveal within this window. */
23
21
constACCELERATED_REMAINING_MS=1_500;
@@ -50,20 +48,27 @@ function usePendingConciergeResponse(reportID: string | undefined) {
50
48
// pendingResponse/tokens/fullHtml — without this snapshot, those non-content
51
49
// updates would cancel the running interval and restart the reveal. The
52
50
// useEffect keeps ref writes in the commit phase (React-Compiler-safe).
0 commit comments