Skip to content

fix(webapp): keep the branches list query string when archiving a branch - #4724

Merged
isshaddad merged 4 commits into
mainfrom
fix/preserve-branches-query-string-on-archive
Aug 19, 2026
Merged

fix(webapp): keep the branches list query string when archiving a branch#4724
isshaddad merged 4 commits into
mainfrom
fix/preserve-branches-query-string-on-archive

Conversation

@claude

@claude claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Before: archiving a branch dropped the query string on the way back to the branches list, so the list reset to page 1. Working down a long list meant re-navigating to the page you were on after every archive.

After: you land back on the exact page you archived from, with page, search and showArchived intact.

The archive action now redirects to the page the request came from instead of rebuilding a bare branches path.

How

The archive dialog already submits the page it was opened from as a hidden redirectPath field (${location.pathname}${location.search}), and the failure path already redirected to it — only the success path ignored it and rebuilt the path with branchesPath/branchesDevPath, which have no query string. Both paths now redirect to the submitted path, run through the existing sanitizeRedirectPath helper to keep the redirect same-origin (the same idiom used by resources.batches.$batchId.check-completion).

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

Three files change:

  • apps/webapp/app/routes/resources.branches.archive.tsx — the fix.
  • apps/webapp/test/archiveBranchRedirect.test.ts — new test that drives the archive action and asserts the redirect Location: the query string survives on both success and failure, and an off-origin redirectPath falls back to /. Reverting the fix makes two of the three cases fail, so the test covers the regression.
  • .server-changes/archive-branch-keeps-list-page.md — release-note entry, since this is a user-facing server-only change.

Also ran pnpm run typecheck and oxlint for apps/webapp — both clean.


Changelog

Archiving a branch now returns you to the same page of the branches list instead of resetting it to page 1.


Screenshots

None — no visual change.

Archiving a branch redirected to a rebuilt branches path with no query
string, so the list reset to page 1 and any search or filter was lost.
The archive dialog already submits the page it was opened from as a
hidden redirectPath field, and the failure path already used it, so use
it for the success redirect too (sanitized to stay same-origin).

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ec7a892

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

claude added 2 commits August 19, 2026 18:06
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review


Generated by Claude Code

@claude
claude Bot marked this pull request as ready for review August 19, 2026 18:51

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread apps/webapp/test/archiveBranchRedirect.test.ts
The failure case toggled a module-level flag and reset it inline, so any
early exit between the toggle and the reset would leave the stub in its
failure state for the rest of the file. Reset it in beforeEach instead,
matching dashboardAgentClientMetadata.test.ts and
metadataRouteReplicaLag.guard.test.ts.

Co-Authored-By: Claude <noreply@anthropic.com>
@isshaddad
isshaddad merged commit 4474718 into main Aug 19, 2026
39 checks passed
@isshaddad
isshaddad deleted the fix/preserve-branches-query-string-on-archive branch August 19, 2026 20:45
@github-actions github-actions Bot mentioned this pull request Aug 19, 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.

3 participants