Skip to content

fix(desktop): prevent setFocusedPane from clearing loading state#1373

Merged
Kitenite merged 1 commit into
mainfrom
kitenite/loading-state
Feb 10, 2026
Merged

fix(desktop): prevent setFocusedPane from clearing loading state#1373
Kitenite merged 1 commit into
mainfrom
kitenite/loading-state

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 10, 2026

Summary

  • setFocusedPane was unconditionally setting pane status to "idle", which falsely cleared "working" state when clicking on an active pane
  • Extracted acknowledgedStatus() helper to centralize status-acknowledgment logic and prevent future inconsistencies

Changes

  • apps/desktop/src/shared/tabs-types.ts: Added acknowledgedStatus() — resolves what a pane status should become when the user acknowledges it (review→idle, permission→working, working/idle unchanged)
  • apps/desktop/src/renderer/stores/tabs/store.ts: Replaced inline status transition logic in setActiveTab, setFocusedPane, and clearWorkspaceAttentionStatus with the new helper

Test Plan

  • Start an agent task, click on the pane while it's working — status should remain "working"
  • Let an agent finish on a background tab, switch to it — "review" status clears to "idle"
  • Trigger a permission prompt on a background tab, switch to it — "permission" transitions to "working"

Summary by CodeRabbit

  • Refactor
    • Improved consistency of tab and pane status transitions for more reliable state management during workspace interactions.

setFocusedPane was unconditionally setting pane status to "idle",
which falsely cleared "working" status when clicking on a pane.

Extract acknowledgedStatus() helper to shared/tabs-types and use it
in setActiveTab, setFocusedPane, and clearWorkspaceAttentionStatus.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

A centralized acknowledgedStatus() resolver function is introduced to standardize status transitions across tab and pane updates. The function maps "review"→"idle" and "permission"→"working" statuses, replacing ad-hoc transitions throughout the tabs store with consistent, derived status values.

Changes

Cohort / File(s) Summary
Status Resolution Utility
apps/desktop/src/shared/tabs-types.ts
New acknowledgedStatus() function exported to map pane statuses on user acknowledgment: "review"→"idle", "permission"→"working", with others unchanged and undefined defaulting to "idle".
Tabs Store Integration
apps/desktop/src/renderer/stores/tabs/store.ts
Replaces ad-hoc status transitions with acknowledgedStatus() resolver calls across multiple update paths: setActiveTab, setFocusedPane, clearWorkspaceAttentionStatus, and tab/pane mutation operations, ensuring consistent status derivation throughout the store.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 A mapper true, so clean and neat,
Transforms those statuses quite sweet,
From "review" to "idle," permission's plea,
One function rules them, unified spree,
Status resolved, harmoniously! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main fix—preventing setFocusedPane from clearing the loading/working state—which is the primary issue addressed in the changeset.
Description check ✅ Passed The PR description is comprehensive and well-structured. It clearly explains the problem, lists the files changed, provides implementation details, and includes a concrete test plan covering the key scenarios.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/loading-state

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Kitenite Kitenite merged commit 84bd2ad into main Feb 10, 2026
6 checks passed
@Kitenite Kitenite deleted the kitenite/loading-state branch February 10, 2026 21:35
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app
  • ⚠️ Streams Fly.io app

Thank you for your contribution! 🎉

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