Skip to content

fix(renderer): cancel signout auth retry on unmount - #20905

Merged
OrcaWin merged 1 commit into
mainfrom
np-oom-scan-signout-retry
Sep 18, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
np-oom-scan-signout-retry

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 0 0 0 0
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7

Problem

The unexpected-signout card schedules an auth retry that can fire after the card unmounts.

Fix

Track and clear the retry timer during effect cleanup.

Validation

Staged oxlint and React lint passed.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ Fix is correct; one minor test-coverage gap noted below.

Reviewed changes

  • Cancel the auth-refresh retry on unmount — UnexpectedSignoutCard's mount effect now stores the 500 ms retry timer handle and clears it in the effect cleanup, so a scheduled retry can no longer fire after the card unmounts.

ℹ️ The unmount-cancel path has no regression test

unexpected-signout-card.test.tsx covers the full card lifecycle but nothing pins this fix, and the only stated validation is lint. A test that resolves the auth read to null, unmounts before the 500 ms retry, and asserts the fetch is not called again would lock in the behavior and would fail if the clearTimeout cleanup were removed.

Technical details
# Add an unmount-retry regression test

## Affected sites
- `src/renderer/src/components/UnexpectedSignoutCard.tsx:86` — the new `clearTimeout` is untested
- `src/renderer/src/components/unexpected-signout/unexpected-signout-card.test.tsx` — where the test belongs

## Required outcome
- A test that schedules a retry (auth read resolves `null`), unmounts, advances the fake timer by 500 ms, and asserts `fetchOrcaProfileAuthStatus` was called once rather than twice.
- The test must fail when the `clearTimeout` cleanup is removed.

## Suggested approach
- `vi.useFakeTimers()`; stub `fetchOrcaProfileAuthStatus` to resolve `null`; `render(<UnexpectedSignoutCard />)`; `await act(async () => {})`; `cleanup()`; `act(() => vi.advanceTimersByTime(500))`; assert the fetch call count.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin force-pushed the np-oom-scan-signout-retry branch from 67b718b to 42a1b16 Compare September 16, 2026 03:28
@OrcaWin
OrcaWin changed the base branch from np-oom-scan to main September 16, 2026 03:28
@OrcaWin
OrcaWin merged commit d3032da into main Sep 18, 2026
34 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
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