fix(webapp): keep the branches list query string when archiving a branch - #4724
Merged
Merged
Conversation
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>
|
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
@coderabbitai review Generated by Claude Code |
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>
ericallam
approved these changes
Aug 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,searchandshowArchivedintact.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
redirectPathfield (${location.pathname}${location.search}), and the failure path already redirected to it — only the success path ignored it and rebuilt the path withbranchesPath/branchesDevPath, which have no query string. Both paths now redirect to the submitted path, run through the existingsanitizeRedirectPathhelper to keep the redirect same-origin (the same idiom used byresources.batches.$batchId.check-completion).✅ Checklist
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 redirectLocation: the query string survives on both success and failure, and an off-originredirectPathfalls 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 typecheckandoxlintforapps/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.