Skip to content

fix: an arrival to the already-anchored day could drop its editor focus intent - #1055

Open
ocavue wants to merge 2 commits into
masterfrom
fix/daily-stream-arrival-focus-republish
Open

ocavue wants to merge 2 commits into
masterfrom
fix/daily-stream-arrival-focus-republish

Conversation

@ocavue

@ocavue ocavue commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

A same-position arrival (e.g. re-navigating to today while the stream is already anchored there) writes the pending focus slot after the render pass and triggers no scroll, so the rows never re-read it; the stream now forces one pre-paint re-render per arrival, which also stabilizes the flaky webkit run of daily-stream.focus.test.tsx.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where pending focus information might not appear after navigating in the daily stream.
    • Focused rows now refresh reliably, even when navigation does not change the scroll position.
    • Prevented stale autofocus from being applied when returning to the daily stream through navigation history.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 50c4b23e-09de-4e9f-9087-3b0055cd99ae

📥 Commits

Reviewing files that changed from the base of the PR and between cdb16cf and 4f3a07a.

📒 Files selected for processing (2)
  • apps/desktop/src/components/daily-stream.focus.test.tsx
  • apps/desktop/src/components/daily-stream.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/components/daily-stream.tsx

Walkthrough

DailyStream now refreshes focus state after fresh and restored arrivals. Restored arrivals clear pending autofocus and scroll state. Tests capture router navigation and verify that back navigation disables stale autofocus.

Changes

DailyStream focus refresh

Layer / File(s) Summary
Refresh focus after navigation
apps/desktop/src/components/daily-stream.tsx
Fresh arrivals set target focus and scroll state. Restored arrivals clear pending focus and scroll state. Both paths trigger one bounded re-render.
Verify restored navigation cancellation
apps/desktop/src/components/daily-stream.focus.test.tsx
The test harness captures navigate and back. A regression test verifies that back navigation clears pending autofocus after delayed rendering.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary focus-intent bug fixed by the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/daily-stream-arrival-focus-republish

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop/src/components/daily-stream.tsx`:
- Around line 213-216: Update the savedScroll handling in daily-stream to clear
the focus refs and invoke republishFocusPending before returning whenever
savedScroll() returns a value, ensuring restored arrivals do not retain stale
autoFocus props. Add a regression test covering navigation away and back through
this restored-arrival sequence.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf3bb74a-4735-4b7b-8105-2c19f95911be

📥 Commits

Reviewing files that changed from the base of the PR and between db7d843 and cdb16cf.

📒 Files selected for processing (1)
  • apps/desktop/src/components/daily-stream.tsx

Comment thread apps/desktop/src/components/daily-stream.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant