Skip to content

Autosave overwrites changes in link modal #15719

Open

Description

@stinesandberg

Describe the Bug

When using autosave interval, the autosaving overwrites link type in rich text link modal with old value.

Screen.Recording.2026-02-23.at.10.36.24.mov

Link to the code that reproduces this issue

https://github.com/stinesandberg/payload-reproduction-autosave-issue

Reproduction Steps

  1. Write some text in the rich text field
  2. Click the button to add a link to some of the text
  3. When the modal opens, switch the link type to "Internal URL" and wait until the autosave kicks in
  4. The UI reverts back to "Custom URL"

Which area(s) are affected?

Not sure

Environment Info

Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.27.0
Relevant Packages:
  payload: 3.77.0
  @payloadcms/payload-cloud: 3.77.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:22 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12

Activity

  1. added
    status: needs-triage
    validate-reproduction
    on Feb 23, 2026
  2. removed
    validate-reproduction
    on Feb 23, 2026
  3. removed
    status: needs-triage
    on Feb 23, 2026
  4. harsha-cpp commented on Jun 9, 2026

    @harsha-cpp

    taking a look at this. the bug is in DrawerContent — its useEffect has data in the dependency array, so any time data changes it re-fetches form state and resets the drawer. LinkEditor's registerUpdateListener fires on every lexical update (including autosave), which calls setStateData with fresh node fields — changing the data prop and triggering the reset. fix: skip setStateData while the drawer is open.

  5. added
    status: verified
    on Jun 19, 2026
  6. mathieusouflis commented on Jul 6, 2026

    @mathieusouflis

    Hi, having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bugstatus: verified

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions