Refresh-on-focus answers with the current callback as soon as the page is drawn (#1036) #1040
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/1036-focus-refresh-current"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1036.
Summary
useFocusRefreshkept the latestrefreshcallback 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
changelog.d/1036-focus-refresh-current.fixed.mdTest plan
useTalk.test.jsxcovers a focus that arrives in the commit where the callback changes.🤖 Generated with Claude Code