Stale saved sort after a field becomes virtual silently hides collection documents
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with the _community fixture and its browser tests linked in the issue, then trace how the saved collection-posts preference reaches the posts list query and how query errors are rendered. Run the supplied Playwright reproduction with the stale -computedValue sort. Done means the seeded post remains visible or the admin shows an actionable error that lets the user reset the invalid saved sort. A linked open pull request is already addressing this issue.
Written by the indexing model from the issue text.
Description
Describe the Bug
A saved collection sort can outlive the field's ability to be queried. After a stored field becomes virtual, Payload reuses that user's saved sort and rejects the list query. On current 3.x, the Admin Panel silently displays "No Results" even though documents exist. There is no explanation that the saved sort is invalid.
This is account-specific because the sort is stored in payload-preferences. Clearing browser cookies/cache does not repair it. An explicit valid sort in the URL restores the list.
The original report was a blank list area with the sidebar still visible on Payload 3.90.0/Postgres in production. The reproduction on current 3.x (3.93.0) shows a misleading empty list instead. Older versions derived error names from class names, while the list renderer checks err.name !== 'QueryError'; production minification is a suspected contributor to the different presentation. Current 3.x explicitly sets QueryError.name. I have not rebuilt the standalone reproduction in production mode.
Expected: A stale sort should not make existing documents appear missing. Discard the invalid ordering and use the collection's default, or show an actionable error with a way to reset the saved setting.
Link to the code that reproduces this issue
https://github.com/jenslys/payload/tree/c170f08b38/test/_community
This branch changes only the _community fixture, its generated types, and its browser tests. It does not patch Payload.
Reproduction Steps
-
Check out
repro/3x-stale-list-sortin the linked fork and runpnpm install. -
Start the fixture with a disposable SQLite database:
PAYLOAD_DATABASE=sqlite SQLITE_URL=file:./stale-sort-reproduction.db pnpm dev _communityThe repository's test runner can clear the test database on startup.
-
Open
/admin/collections/postson the printed localhost origin. The normal development user signs in automatically. -
The list shows "No Results", despite the seeded
example post. -
Open
/admin/collections/posts?sort=title. The same post becomes visible.
The seed creates this database-backed preference for the development user:
{
"key": "collection-posts",
"value": {
"sort": "-computedValue"
}
}
computedValue is now a text field with virtual: true. The seed represents a preference saved while that field was still stored, avoiding two builds and a schema migration just to reproduce the stale state.
The underlying query rejection is:
The following path cannot be queried: computedValue
Verified browser regression
pnpm exec playwright install chromium
PAYLOAD_DATABASE=sqlite SQLITE_URL=file:./stale-sort-reproduction.db PORT=3187 \
pnpm test:e2e _community --workers=1
Observed result on upstream 3.x at 2a1a9c83d9:
- Pass: Explicit valid sort restores the seeded post.
- Fail: Loading the list with the stale saved sort does not show the existing post. The assertion times out, and the browser snapshot shows "No Results".
- Both tests successfully create and delete their own preference through the authenticated preference endpoint.
The failing assertion intentionally specifies the expected recovery behavior; the branch is a reproduction, not a fix.
Which area(s) are affected?
area: ui, area: core, db: sqlite, db: postgres
Environment Info
Reproduction:
Payload packages: 3.93.0 (upstream 3.x checkout at 2a1a9c83d9)
Next.js: 16.4.1
React: 19.2.9
Node.js: 22.23.5
pnpm: 11.28.6
Database: SQLite
Playwright: 1.63.0, Chromium
OS: macOS, arm64
Original production report:
Payload packages: 3.90.0
Next.js: 16.4.3
Database: Postgres
Related: #12886 fixed enabling sort headers on virtual fields. This case concerns an already persisted sort that became invalid after a schema change; it does not require clicking a virtual field's sort header.
- Dominant language
- TypeScript
- Stars
- 45.8k
- Forks
- 4.4k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 251
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Document bar (.doc-controls__content) overflows a 375 px viewport, clips "Created" and fails axe scrollable-region-focusablePossibly taken A pull request linked to this issue is open or already merged. Openarea: ui Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#19690 ·
Maintainers usually reply within 1 day
-
[v4] Blocks thumbnails croped 3:2Possibly taken @samiarif02 claimed this 2 days ago. Openarea: ui Bug Payload OSS status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
payloadcms/payload#19609 ·
Maintainers usually reply within 1 day
-
Scheduled publish jobs are not deleted when their document is deleted (string id in the job, raw id in the cleanup)Possibly taken @volodymyrshk claimed this 10 days ago. Openarea: core Bug db: sqlite
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19448 ·
Maintainers usually reply within 1 day
-
plugin-multi-tenant: `isGlobal` collections redirect tenant-scoped users to `/admin` since 3.93.0 (GlobalViewRedirect prop-name mismatch)Possibly taken @JarrodMFlesch claimed this 10 days ago. OpenBug plugin: multi-tenant
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19420 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
milind-soni/OpenMausBot#6730 ·
Maintainers usually reply within 1 day
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:image documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day