Skip to content

Cache components might cause full page refresh when selecting a media #16270

@mattiaz9

Description

@mattiaz9

Describe the Bug

When cacheComponents is enabled sometimes, when trying to select a media, the fast refresh makes a full page reload causing loss in changes made.
The issue seems quite random, but sometimes it's so constant that it makes it impossible to select a media. Other times after a reload the media drawer stays open (like in the video below)

Link to the code that reproduces this issue

https://github.com/mattiaz9/payload/tree/bug/media-selection

Reproduction Steps

  1. Go to media and upload at least 10 medias
  2. edit the example post
  3. try to select a thumbnail (it may take a few tries before it happens)
  4. the page reload
screen-rec.mp4

Which area(s) are affected?

area: core

Environment Info

Binaries:
  Node: 24.12.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.32.1
Relevant Packages:
  payload: 3.82.0
  next: 16.2.3
  @payloadcms/db-postgres: 3.82.0
  @payloadcms/drizzle: 3.82.0
  @payloadcms/email-resend: 3.82.0
  @payloadcms/graphql: 3.82.0
  @payloadcms/live-preview: 3.82.0
  @payloadcms/live-preview-react: 3.82.0
  @payloadcms/next/utilities: 3.82.0
  @payloadcms/plugin-cloud-storage: 3.82.0
  @payloadcms/plugin-form-builder: 3.82.0
  @payloadcms/plugin-mcp: 3.82.0
  @payloadcms/plugin-nested-docs: 3.82.0
  @payloadcms/plugin-redirects: 3.82.0
  @payloadcms/plugin-seo: 3.82.0
  @payloadcms/richtext-lexical: 3.82.0
  @payloadcms/storage-s3: 3.82.0
  @payloadcms/translations: 3.82.0
  @payloadcms/ui/shared: 3.82.0
  react: 19.2.5
  react-dom: 19.2.5
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreCore Payload functionalitystatus: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions