Refresh-on-focus answers with the current callback as soon as the page is drawn (#1036) #1040

Merged
claude-bot merged 2 commits from fix/1036-focus-refresh-current into main 2026-10-02 22:46:02 +00:00
Collaborator

Closes #1036.

Summary

useFocusRefresh kept the latest refresh callback in a ref and updated that ref in a passive effect, which runs a moment after the commit. Thread's callback refreshes only once the thread has loaded, so a focus arriving just as it loaded met the callback from the render before and did nothing. The ref is now set in a layout effect, inside the commit. One hook, three callers (Thread, useThreads, useTalkCount).

This is also what fails Thread.test.jsx ("keeps them marked after the thread is read again…") on a busy runner. It has turned PR #1034, which is backend only, red twice.

Changelog

  • Fragment added: changelog.d/1036-focus-refresh-current.fixed.md

Test plan

  • New useTalk.test.jsx covers a focus that arrives in the commit where the callback changes.
  • CI on this PR. Not run locally in this session.

🤖 Generated with Claude Code

Closes #1036. ## Summary `useFocusRefresh` kept the latest `refresh` callback in a ref and updated that ref in a passive effect, which runs a moment after the commit. Thread's callback refreshes only once the thread has loaded, so a focus arriving just as it loaded met the callback from the render before and did nothing. The ref is now set in a layout effect, inside the commit. One hook, three callers (`Thread`, `useThreads`, `useTalkCount`). This is also what fails `Thread.test.jsx` ("keeps them marked after the thread is read again…") on a busy runner. It has turned PR #1034, which is backend only, red twice. ## Changelog - [x] Fragment added: `changelog.d/1036-focus-refresh-current.fixed.md` ## Test plan - [x] New `useTalk.test.jsx` covers a focus that arrives in the commit where the callback changes. - [ ] CI on this PR. Not run locally in this session. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refresh-on-focus answers with the current callback as soon as the page is drawn (#1036)
Some checks failed
CI / Bot/backend version sync (pull_request) Successful in 32s
CI / Backend lint (ruff) (pull_request) Successful in 55s
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m23s
CI / Feedback site tests (pull_request) Successful in 53s
CI / Does this change touch the recording path? (pull_request) Successful in 39s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Docker image build (pull_request) Successful in 56s
CI / Bot tests and audit (pull_request) Successful in 2m5s
CI / Frontend (shard 1/2) (pull_request) Successful in 10m33s
CI / End-to-end journeys (phone) (pull_request) Successful in 11m4s
CI / End-to-end journeys (keyboard) (pull_request) Successful in 11m39s
CI / Frontend (shard 2/2) (pull_request) Failing after 15m0s
CI / End-to-end journeys (desktop) (pull_request) Successful in 12m38s
CI / Backend migration, tests, and audit (pull_request) Successful in 37m19s
31dc2047c0
useFocusRefresh updated its ref in a passive effect, which runs a moment after
the commit. Thread's callback refreshes only once the thread has loaded, so a
focus arriving just as it loaded met the callback from the render before and
did nothing. It is what failed Thread.test.jsx on a busy runner in #1034's run.
The ref is now set in a layout effect, inside the commit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merge remote-tracking branch 'origin/main' into fix/1036-focus-refresh-current
All checks were successful
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m7s
CI / Bot/backend version sync (pull_request) Successful in 27s
CI / Feedback site tests (pull_request) Successful in 45s
CI / Does this change touch the recording path? (pull_request) Successful in 25s
CI / Backend lint (ruff) (pull_request) Successful in 1m18s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Docker image build (pull_request) Successful in 1m12s
CI / Bot tests and audit (pull_request) Successful in 4m39s
CI / Frontend (shard 2/2) (pull_request) Successful in 9m6s
CI / Frontend (shard 1/2) (pull_request) Successful in 11m8s
CI / End-to-end journeys (phone) (pull_request) Successful in 11m13s
CI / End-to-end journeys (desktop) (pull_request) Successful in 20m9s
CI / Backend migration, tests, and audit (pull_request) Successful in 24m25s
CI / End-to-end journeys (keyboard) (pull_request) Successful in 19m29s
666ca5272c
claude-bot deleted branch fix/1036-focus-refresh-current 2026-10-02 22:46:03 +00:00
Sign in to join this conversation.
No description provided.