Skip to content

Back button loads outdated document after save #12914

@MarvinVrdoljak

Description

@MarvinVrdoljak

Describe the Bug

When editing and saving a document in the Payload CMS admin panel, then navigating to a different page and returning via the browser's back button, the previously saved state is not reflected. Instead, the editor shows the old state of the document — the one before the latest save. If a user unknowingly makes changes and hits "Save" again, all recent updates will be overwritten by the outdated version. This behavior leads to accidental data loss. I experienced this several times, unintentionally overwriting previously updated content.

This issue occurs by default — no customizations have been made. It can be reproduced using the unmodified Payload website template.

Link to the code that reproduces this issue

https://github.com/MarvinVrdoljak/payload-bug-report-3

Reproduction Steps

  1. Go to the admin panel and open a document for editing.
  2. Make changes and click Save.
  3. Navigate to a different route.
  4. Click the browser’s back button to return to the previous document.
  5. Observe: the editor displays the outdated version of the document (prior to the last save).
  6. If you now hit Save, this outdated version will overwrite your latest changes.
Aufzeichnung.2025-06-24.132925.mp4

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

area: core

Environment Info

Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.10.0
Relevant Packages:
  payload: 3.43.0
  next: 15.3.0
  @payloadcms/db-mongodb: 3.43.0
  @payloadcms/email-nodemailer: 3.43.0
  @payloadcms/graphql: 3.43.0
  @payloadcms/live-preview: 3.43.0
  @payloadcms/live-preview-react: 3.43.0
  @payloadcms/next/utilities: 3.43.0
  @payloadcms/payload-cloud: 3.43.0
  @payloadcms/plugin-form-builder: 3.43.0
  @payloadcms/plugin-nested-docs: 3.43.0
  @payloadcms/plugin-redirects: 3.43.0
  @payloadcms/plugin-search: 3.43.0
  @payloadcms/plugin-seo: 3.43.0
  @payloadcms/richtext-lexical: 3.43.0
  @payloadcms/translations: 3.43.0
  @payloadcms/ui/shared: 3.43.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 15672
  Available CPU cores: 22

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions