Repository navigation
fix(sidebar): a worktree card fetches its Linear issue again only when the issue or its source changes - #30904
Conversation
…n the issue or its source changes The card rebuilt its Linear source context on every workspace write, and both card Linear effects listed that object as a dependency, so a comment, agent status or activity update re-ran them and refetched the issue whenever the 60s cache had expired. Hold the context while it is equal to the rebuilt one. Tracked in STA-10988. Same approach as community PR #30090.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
Real-app QA: main vs this branch (Windows, hidden dev builds)Question tested: does a sidebar card with a linked Linear issue keep asking for that issue while the workspace gets updated, and does it still refresh when it should? Setup: hidden dev test copies of Orca on Windows (throwaway home, no Linear account connected, so every read is answered locally and nothing reaches Linear). A scratch project, its card showing the "Linear issue" property, linked to ENG-1. Then 48 real workspace comment updates, one every 5 seconds for 4 minutes, on each build. Calls were counted at the store's
Card rendering with a seeded issue is identical on both builds (title, identifier, status badge, hover details): Not covered here: a read through a real signed-in Linear account (this change doesn't touch the read itself, only when it is triggered), SSH and folder workspaces, and real OS focus changes (focus was simulated with a window focus event). |
|
A sidebar card rebuilt its Linear source context after unrelated workspace updates, so note and activity changes could repeatedly fetch the linked issue. This change retains the context while its values are equal. Those metadata writes stop triggering fetches; changing the issue or its source still refreshes it. Review completed on Authenticated main-versus-branch QA completed in a hidden app through qa-gate. Both builds went from disconnected through the Settings connection form to displaying the real STA-10988 title and Triage status. The branch reused the profile created by main through an actual app restart, retaining the repo, linked issue, settings and prior note.
After 75 seconds, the branch's focus event caused exactly one fetch and one fresh, non-null read of the same real issue. Counters and build identity were independently checked from saved per-write assertions. Earlier four-minute Windows QA separately measured 48 calls/four reads on main versus zero/zero on the branch; initial reads, relinking and source-change controls also passed. The authenticated supplement used one account and does not claim a second-account transition. QA method limitations: two prohibited coordinate-based CDP mouse movements occurred. The first was found after that driver exited; the second driver was stopped by its verified PID. No OS input, desktop focus or window activation was reported. The branch driver exited 3 after saving the functional checks and disconnect action; this is acceptance of the saved assertions, not a successful driver completion or a claim of fully compliant methods. A redundant setup-install invocation was also discovered afterward; its lockfile churn was reversed. Disposable app/driver homes were removed, recorded processes exited, and real config hashes were unchanged. Existing attachment-hover refetching and missing provider rate-limit backoff remain outside this change. Live SSH/folder-workspace variants and native OS focus transitions were not exercised. Preserving the existing cache, focus and routing behavior around value-based context retention is an intended difference from the common pattern's surrounding implementation. For Brennan's review Main, authenticated issue after metadata writes: Branch, the same authenticated issue after expired-cache focus refresh: These demonstrate functional card content, not pixel equivalence: theme and capture scale changed within the main run itself, with the theme trigger unverified; notes and onboarding state also differ. Earlier Windows comparison and screenshots. The main judgment point is retaining the source context while equal. |






ELI5
A sidebar card with a linked Linear issue is supposed to load that issue when the card appears and when you come back to the Orca window. Instead it reloaded the issue every time anything about the workspace changed: a comment edit, an agent status change, a new activity time. With a few busy Linear-linked workspaces, that is a steady stream of Linear requests, enough to use up the Linear rate limit. After this change the card loads the issue again only when the linked issue or the Linear source it is read from actually changes.
What Changed
Mechanism: the card builds a "source context" (which host, project and account to read the issue through) from the workspace object. Every workspace update replaces that object, so the context was rebuilt as a new object each time, and both card effects that fetch the Linear issue listed the context as a dependency.
use-worktree-card-review-details.tsnow keeps the previous context object while the rebuilt one is equal to it (using the existingareTaskSourceContextsEqual), so the effects only see a change when there is one.Why
The structural cause is that the fetch effects were triggered by an object's identity rather than by the identity of what they read. The common pattern for this is to keep a value's previous reference while its content is unchanged, so anything keyed on it only reacts to real changes. That is what this does, at the one place the context is produced, so every consumer of it gets a stable value.
Alternatives considered:
useEffectEvent. Rejected:WorktreeCardis aReact.memocomponent, and in React 19.2.8 the commit step that refreshes an effect event skips memo components, so the effect read the previous render's context (verified in the test below before switching).Credit: this is the same approach as community PR #30090 by calebcassel, who found the cause. This PR adds a test that a real source change still refetches through the new source.
Not in this PR (same class, smaller impact): the hover details card (
use-workspace-reference-details.ts) also rebuilds its attachment requests from the workspace object, so while a hover card is open, workspace updates re-read the attachments. It is bounded to while the hover card is open and sits behind the same 60-second caches; a safe fix there needs a request key that also covers the branch and attachment title, so it is a separate change.Linked Issue
Tracked in STA-10988.
Visual Proof
N/A: no visual change. Real-app evidence (fetch counts on main vs this branch while workspace updates run) is attached in a comment below.
Testing
WorktreeCard.hosted-review-refresh.test.tsx: a Linear-linked card re-rendered with only its comment and activity time changed fetches once (fails on main with two fetches, passes here); then a real source change (another host and project) fetches again with the new source.Real Orca test copy: see the QA comment.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Plan: keep the card's Linear source context value-stable at the one place it is built, so the two card effects that fetch the Linear issue re-run only when the issue, the Linear workspace or the source really changes. One production file, one test.
Light path classification:
use-worktree-card-review-details.ts).git log --since="30 days ago"onuse-worktree-card-review-details.tsanduse-worktree-card-lifecycle-effects.tsshows feat(sidebar): main produces per-workspace PR facts, checked against the window in dev and test #30026, fix(notifications): hidden workspaces stop notifying unless you opt in #28870, Fix linked reviews stuck loading on detached workspaces #28228, b1cd858 and Refresh visible reviews automatically and stop settled merged polling #25788; none fixes Linear issue refetching, and there is no revert or incident on these files.Agent skill upstream boundary
Notes
Renderer only: no saved data, wire or visual change. SSH, WSL and runtime hosts: a host change still produces a different context and refetches. Folder workspaces: unaffected (same context derivation).
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)