Skip to content

fix(ui): don't wipe the current project when a stale fetch rejects - #321

Merged
martian56 merged 2 commits into
Devlaner:mainfrom
cavidelizade:fix/fetch-rejection-race
Oct 25, 2026
Merged

martian56 merged 2 commits into
Devlaner:mainfrom
cavidelizade:fix/fetch-rejection-race

Conversation

@cavidelizade

Copy link
Copy Markdown
Contributor

Summary

The issue-list aggregate load guarded only the first setter in its .catch; the rest ran unconditionally. Opening project A then quickly switching to B — if A's request rejected after B had loaded — cleared B's issues/states/labels/cycles/modules and left an empty page for a perfectly valid project.

Linked issues

Closes #316

Type of change

  • Bug fix (fix:)

Surface

  • UI (apps/web/)

What changed

  • IssueListPage: replaced if (!cancelled) setWorkspace(null) (with 8 unguarded setters after it) with an early if (cancelled) return; so the whole reset is skipped for a stale request.
  • Applied the same one-line guard to ProjectsListPage and both loaders in PageHeader, which had the identical partial-guard pattern.

Why this approach

The cancelled flag already exists (flipped in each effect's cleanup); it was just applied to one line instead of the block. Early-returning the entire catch is the smallest correct fix and matches how the .then/.finally handlers in the same effects already guard.

Test plan

  • npm run typecheck + npm run lint pass
  • Manual: throttle the network, open project A, immediately switch to B; A's load loses the race and rejects → B stays intact (before this change B blanked out).

AI assistance

  • AI tools were used — tool(s): Claude Code (Opus 4.8) — commits carry a Co-Authored-By: trailer

The issue-list aggregate load guarded only the first setter in its .catch;
the remaining setters ran unconditionally. Opening project A then quickly
switching to B, if A's request rejected after B loaded, cleared B's
issues/states/labels/cycles/modules and showed an empty page for a valid
project. Guard the whole catch body with the cancelled flag. Same one-line
guard applied to ProjectsListPage and the two PageHeader loaders.

Closes Devlaner#316

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cavidelizade
cavidelizade requested a review from a team as a code owner July 16, 2026 09:59
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4b85aa3c-37cd-416f-a4d5-68348ea1db6b
Commits

Reviewing files that changed from the base of the PR and between df31029 and 2beb37d.

Files selected for processing: 3
  • apps/web/src/components/layout/PageHeader.tsx
  • apps/web/src/pages/IssueListPage.tsx
  • apps/web/src/pages/ProjectsListPage.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@cavidelizade

Copy link
Copy Markdown
Contributor Author

@martian56 #316 — on the issue list, a background request rejecting after you'd already switched projects would blank out the project you were looking at (only the first setter was guarded). Guarded the whole catch across the list page and the two other spots with the same pattern. Green, no open comments. Good to merge?

Keep main's narrower reset (workspace + project) and error log, behind
this branch's early return for cancelled requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martian56
martian56 merged commit 7642e97 into Devlaner:main Oct 25, 2026
2 checks passed
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.

Rejected background fetch clears the currently-viewed project on the issue list

2 participants