Skip to content

Search query is not preserved when navigating back to list view #9132

@dietmarweiss

Description

@dietmarweiss

Describe the Bug

When you use the search or filter feature on a collection's list view, click an item from the results and then navigate back,
the search (or filter) query params briefly appear in the Browsers' URL bar but then quickly disappear, losing the search (or filter) state.

This issue has been reported before (#8086) and was apparently fixed, but seems to have resurfaced.

Link to the code that reproduces this issue

https://github.com/dietmarweiss/payload-query-params-lost

Reproduction Steps

  1. Run pnpm install to install dependencies
  2. Run pnpm dev _community to start the admin panel
  3. navigate to the 'Posts' list view (http://localhost:3000/admin/collections/posts)
  4. Enter "example" in the search field (or navigate to http://localhost:3000/admin/collections/posts?limit=10&page=1&search=example)
  5. Click on the (only) item from the list
  6. Navigate back

Expected behaviour:
The Browser's URL bar preserves the "search" query param

Actual behaviour:
The "search" param briefly appears but is then removed from the URL

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Binaries:
  Node: 22.6.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: 9.7.1
Relevant Packages:
  payload: 3.0.0-beta.127
  next: 15.0.0
  @payloadcms/db-postgres: 3.0.0-beta.127
  @payloadcms/live-preview: 3.0.0-beta.127
  @payloadcms/live-preview-react: 3.0.0-beta.127
  @payloadcms/next/utilities: 3.0.0-beta.127
  @payloadcms/ui/shared: 3.0.0-beta.127
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
screen-recording.mp4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions