Skip to content

fix(frontend): keep the current branch when opening tasks from the header - #10110

Open
bilalabbad wants to merge 2 commits into
stablefrom
fix/task-status-link-keeps-current-branch
Open

fix(frontend): keep the current branch when opening tasks from the header#10110
bilalabbad wants to merge 2 commits into
stablefrom
fix/task-status-link-keeps-current-branch

Conversation

@bilalabbad

@bilalabbad bilalabbad commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Why

Clicking the task-status button in the header while working on a non-default branch took you to the tasks page but silently reset the branch selector to main, so you lost your working branch just by checking on tasks.

The link built its branch query param from window.location, which nuqs updates one render after the branch context — so the href always lagged one branch switch behind (empty on the first switch), while its filters param carried the correct branch:

after picking platform-conflict:     href = /tasks?filters=[…"platform-conflict"]                ← no branch at all
after picking jfk1-update-edge-ips:  href = /tasks?branch=platform-conflict&filters=[…"jfk1-…"]  ← previous branch
after picking atl1-delete-upstream:  href = /tasks?branch=jfk1-update-edge-ips&filters=[…"atl1-…"]

What changed

  • The header task-status link now keeps you on your current branch, and correctly drops the branch param when you are on the default branch.
  • TaskStatus derives the param from currentBranch — which it already holds — instead of inheriting it from the ambient URL.
  • Non-goal: constructPath still reads window.location during render, so the same staleness can affect any link rendered outside a useLocation subscriber. Left for a follow-up.

How to review

Single behavioural change in frontend/app/src/entities/tasks/ui/task-status.tsx. The is_default branchpoint exists because constructPath ignores a null value and needs exclude: true to remove a param.

How to test

cd frontend/app && pnpm vitest run src/entities/tasks/ui/task-status.test.tsx

Two new tests: the branch must come from the context (fails before this change), and the param must be absent on the default branch. Manually: switch to a non-default branch, click the task-status button, confirm the selector still shows your branch.

Impact & rollout

  • Backward compatibility: none — URL shape unchanged, only correctly populated.
  • Deployment notes: safe to deploy.

Review in cubic

@bilalabbad bilalabbad added the type/bug Something isn't working as expected label Aug 3, 2026
@bilalabbad
bilalabbad requested a review from a team as a code owner August 3, 2026 13:51
@bilalabbad bilalabbad added the group/frontend Issue related to the frontend (React) label Aug 3, 2026

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Bug fix: task-status link now uses the current branch from context instead of a stale URL value. The change is small, bounded, and covered by new tests.

Re-trigger cubic

@bilalabbad
bilalabbad force-pushed the fix/task-status-link-keeps-current-branch branch from 602c821 to 1c77911 Compare August 3, 2026 14:40

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Focused frontend fix deriving the branch query param from current branch context instead of a stale URL value, with tests covering non-default and default branches. Bounded bug fix with no API, schema, or rollout impact.

Re-trigger cubic

bilalabbad and others added 2 commits August 3, 2026 15:21
…ader

The header task-status link derived its `branch` query param from
window.location via constructPath, but nuqs writes the branch into the URL
one render after the branch context updates, so the memoized href carried
the previous branch (none at all on the first switch). Navigating there
dropped the branch and BranchesProvider fell back to the default one.

Derive the param from currentBranch instead, excluding it on the default
branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
.agents/rules/code-doc-style.md forbids naming other functions in comments.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bilalabbad
bilalabbad force-pushed the fix/task-status-link-keeps-current-branch branch from 1c77911 to 12b214b Compare August 3, 2026 15:23
@bilalabbad
bilalabbad changed the base branch from release-1.11 to stable August 3, 2026 15:23
@bilalabbad bilalabbad self-assigned this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/frontend Issue related to the frontend (React) type/bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant