[v4] Version view: the current draft and the published version of a localized collection both show "Previously Published"

Open
#19,507 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@josecrc is already working on this.

Since Nov 11, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Domain
backend, frontend

Research direction

Read packages/ui/src/views/Versions/VersionPillLabel/getVersionLabel.ts and packages/ui/src/views/Version/index.tsx, especially the three version lookups described in the issue. Start by tracing how locale-specific _status values are read and how fetchVersion changes req.locale; compare that with the suggested fix and linked pull request #19527. Done means the draft and published versions show their expected labels and the compare dropdown includes the currently published version.

Written by the indexing model from the issue text.

Description

area: ui Bug Payload OSS
Describe the Bug

v4 turns on localizeStatus for collections with drafts and localized fields, so _status is stored per locale. The version view doesn't handle that yet:

  1. Labels. The versions are read with locale: 'all', so version._status is an object such as { en: 'draft', de: 'draft' }. getVersionLabel compares it with 'draft' and 'published', matches neither, and ends at "Previously Published".
  2. Lookups. The latest draft and the previous published version are looked up with locale: 'all' and a _status filter, which matches nothing for a per-locale status (the root cause in #17923). The currently published version uses locale: req.locale, but the fetchVersion call before it has already written 'all' onto req.locale (#18246). None of the three is found, so "Current draft" and "Currently Published" never appear, and the compare dropdown only offers "Previous Version".

Suggested fix (we run this as a patch on beta.8): in getVersionLabel, use _status[currentLocale] when _status is an object. Run the three lookups with locale: userLocale, on isolateObjectProperty(req, ['fallbackLocale', 'locale']), because they run in parallel and each Local API call writes its locale onto the request (#18280 fixes that in general).

Link to the code that reproduces this issue

https://github.com/fabian-michael-asi/payload-v4-issue-repros

Reproduction Steps
  1. Clone, cp .env.example .env, pnpm install.
  2. Create a user and three versions of a post (draft, published, draft), then start the app:
pnpm payload createDocuments --slug users --documents '[{"data":{"email":"[email protected]","password":"test"}}]'
ID=$(pnpm -s payload createDocuments --slug posts --draft --locale en --documents '[{"data":{"title":"v1 draft","items":[{"label":"First item"}]}}]' --json | jq -r '.result.docs[0].id')
pnpm payload updateDocument --slug posts --id "$ID" --locale en --data '{"title":"v2 published","_status":"published"}'
pnpm payload updateDocument --slug posts --id "$ID" --locale en --draft --data '{"title":"v3 draft"}'
pnpm dev
  1. Open the post in English, then Versions, then "v3 draft": the pill says Previously Published, expected Current draft.
  2. Open "v2 published": Previously Published, expected Currently Published.
  3. "Comparing against" only offers "Previous Version", expected an entry for the currently published version.

Version view of the latest draft

Which area(s) are affected?

area: ui

Environment Info
Relevant Packages:
  payload: 4.0.0-beta.8
  next: 16.4.2
  @payloadcms/db-mongodb: 4.0.0-beta.8
  @payloadcms/richtext-lexical: 4.0.0-beta.8
  @payloadcms/ui/shared: 4.0.0-beta.8
  react: 19.3.1
Node: 24.22.2, pnpm: 12.18.0, darwin arm64
Dominant language
TypeScript
Stars
45.8k
Forks
4.4k
Avg merge
2d 16h
Merged PRs (30d)
251

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.