Rich Text Editor media disappears when canceling/closing upload modal (Prod only)

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

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Domain
backend, frontend

Research direction

Start with the reproduction in src/collections/Posts.ts and run the production setup with pnpm build, pnpm docker:build, and pnpm docker:run. Trace the Rich Text Editor upload modal when it is closed without selecting media, comparing production behavior with local mode. Done means existing media remains visible after closing the modal, including in the intermittent production-only case.

Written by the indexing model from the issue text.

Description

area: core status: needs-triage v3
Describe the Bug

Hi, I’m facing a strange issue with the Payload CMS Rich Text Editor upload feature.

Context:

  • The RTE upload feature uses images from my media collection.
  • This issue only happens in staging/production mode.

Expected behavior:

  • Closing the upload modal without selecting media should not affect already uploaded media in the editor.

Observed behavior:

  • Existing media temporarily disappears from the RTE until another media item is selected.

Additional notes:

  • The issue is environment-specific (staging/production only).
  • No issue occurs locally.
  • also please note that this issue is not consistent
Link to the code that reproduces this issue

https://github.com/tpahore/payload-test/blob/main/src/collections/Posts.ts

Reproduction Steps

Issue steps:

  1. Open the Rich Text Editor.
  2. Click “Upload”.
  3. Select an existing image from the media collection.
  4. Click “Upload” again.
  5. This time, click the close/cross button instead of selecting an image.
  6. After closing the modal, all previously uploaded media disappears from the editor.
  7. If I click “Upload” again and select another image, all previously disappeared media appears again along with the newly selected image.

https://github.com/user-attachments/assets/b6f39e33-100e-48cd-aaac-9414a26b746c

Which area(s) are affected?

area: core

Environment Info
Payload version: 3.84.1

please run project in production mode

pnpm build
pnpm docker:build
pnpm docker:run
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

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.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.