fix(ui): keep list query params when refreshing after a bulk edit - #17698
Open
luantaraschi wants to merge 1 commit into
Open
fix(ui): keep list query params when refreshing after a bulk edit#17698luantaraschi wants to merge 1 commit into
luantaraschi wants to merge 1 commit into
Conversation
EditMany's success handler rebuilt the URL from `useSearchParams()`, which is stale in a list view: ListQueryProvider syncs the query to the URL through the History API to avoid a re-render, and the hook never observes that. The refresh therefore navigated to a bare `?_r=<ts>`, dropping columns, filters and limit. Reading the live location keeps them. The Localizer already works around the same staleness the same way.
luantaraschi
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
August 6, 2026 22:22
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.
Fixes #17667.
What
EditMany's success handler rebuilt the post-save URL by spreadingparseSearchParams(searchParams). That value is stale in a list view, so the refresh navigated to a bare?_r=<timestamp>and droppedcolumns,where,limitandsort.Why
useSearchParams()is stale hereListQueryProviderdeliberately writes the list query to the URL through the History API rather than the router, to avoid a re-render —providers/ListQuery/index.tsx#L147-L158:Anything written that way never reaches
useSearchParams(). The repo already documents this exact problem and already works around it in one place —elements/Localizer/index.tsx#L63:EditManyhas the same problem and was missed. This PR applies the same workaround, keepingparseSearchParamsso nested params (where[or][0][and][0]…) still round-trip throughqsatdepth: 10.Verified by running it
test/bulk-edite2e against the dev server, MongoDB in Docker,CI=true(so the run gets CI's 5 retries):1 passedDrawerContent.tsxchange1 failed— and failed on all 6 attempts, so it isn't flakyThe failure message is the bug itself:
And the dev server log shows the two refresh requests side by side:
A note on the test
My first attempt asserted on
page.url()after the save — and it passed without the fix, which is what sent me looking.ListQueryProviderre-adds the params on the next render, so the address bar self-heals within a few hundred ms and hides the bare navigation. That matches the reporter's "depending on render timing the visible column loss either self-heals or becomes permanent."So the test asserts on the refresh request via
page.waitForRequest, which is the thing that actually goes out wrong. Flagging it because a settled-URL assertion here looks correct and silently tests nothing.Scope
I kept this to the handler the issue reports.
upsertPreferences({ columns: columnsFromQuery })trusting URL params — is a broader design question and I left it alone. With the bare navigation gone, the trigger for the preference overwrite is gone too.queryString'sselectAllbranch (DrawerContent.tsx#L252) reads the same stale source. That path is what Bug: List view drops URL "where" filter on bulk Publish/Unpublish/Edit across pages #17670 reports, and fix(ui): forward list filter to bulk actions when selecting all across pages #17695 already addresses it by passingwheredown fromuseListQuery()— so I didn't touch it here to avoid two open PRs editing the same lines.What I did not verify
I did not run the full
bulk-editsuite or a typecheck of the whole monorepo — only the new test, plus the control. The change is one expression inside an event handler with no type change (parseSearchParamstakes aURLSearchParamseither way), so I'd expect CI to be the real check on the rest.Checklist