payloadcms / payloadcms/payload

localizeStatus: fail to retrieve last version

Open
#16,395 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: core stale status: needs-triage v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

When using localizeStatus, in the edit view of a document, the retrieved document is the last draft document. This means that when editing and publishing directly (clicking on the publish button, modifications won't be retrieved).

Link to the code that reproduces this issue

https://github.com/matthieuMay/repro-draft

Reproduction Steps

The repro is a blank template with 2 new collections (Post and Guide) containing a localized title. The Post collection has { draft: { localizeStatus: true } }, the guide has { draft: true }

Go to post,

  • create a new post
  • fill in a title click save drafts
  • modify the title click publish
  • reload page, the first title will appear.

Do the same with guide, the second title will appear

Which area(s) are affected?

area: core

Environment Info
Detected the bug on a postgres project, repro is a sqlite

Contributor guide

Open the contributing guide

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.

Research direction

Start with the linked reproduction and compare the Post configuration using localizeStatus with the Guide configuration using draft: true. Trace the edit, save-draft, publish, and reload flow for the retrieved localized document. Done means the published title is shown after reloading, consistently across the reported database setups.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sqlite, typescript
Domain
backend, databases, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.