payloadcms / payloadcms/payload

Cache components might cause full page refresh when selecting a media

Open
#16,270 3 comments 6 reactions 1 assignee View on GitHub

@AlessioGr is already working on this.

Since May 23, 2026.

area: core
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

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

https://github.com/user-attachments/assets/b9380047-dd81-4859-bc97-636dca86893b

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

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.