payload icon indicating copy to clipboard operation
payload copied to clipboard

Adding blocks to a collection do not always render correctly while Live Preview is open

Open tschwartz opened this issue 1 year ago • 10 comments

Describe the Bug

Adding blocks to a collection do not always render correctly while Live Preview is open, sometimes the loading animation just cycles forever unless the user toggles back to Edit and then back to Live Preview.

Link to the code that reproduces this issue

https://github.com/tschwartz/payload-cms-repro

Reproduction Steps

Expected

  • Run npm install
  • Run npm run dev
  • Navigate to http://localhost:3000/admin
  • Create the default user
  • Navigate to the Pages collection
  • Create a new page
  • Give the page a slug ('home' will work with the root route)
  • Click the Live Preview tab/button
  • Add a Rich Text content block
  • Observe that the Rich Text content renders a form element
  • Enter some content, or don't
  • Add another Rich Text content block
  • Observe that the Rich Text content renders a form element

Observed

  • Run npm install
  • Run npm run dev
  • Navigate to http://localhost:3000/admin
  • Create the default user
  • Navigate to the Pages collection
  • Create a new page
  • Give the page a slug ('home' will work with the root route)
  • Click the Live Preview tab/button
  • Add a Rich Text content block
  • Observe that the Rich Text content renders a form element
  • Enter some content or don't
  • Add another Rich Text content block
  • Observe that the Rich Text content loading animation does not stop and reveal a form element

Note, this is not specific to the Rich Text block but all content block types.

Image

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

Not sure

Environment Info

Binaries:
  Node: 20.18.1
  npm: 11.3.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.35.1
  next: 15.2.4
  @payloadcms/graphql: 3.35.1
  @payloadcms/live-preview: 3.35.1
  @payloadcms/live-preview-react: 3.35.1
  @payloadcms/next/utilities: 3.35.1
  @payloadcms/richtext-lexical: 3.35.1
  @payloadcms/translations: 3.35.1
  @payloadcms/ui/shared: 3.35.1
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:39 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12

tschwartz avatar Apr 30 '25 20:04 tschwartz

Please add a reproduction in order for us to be able to investigate.

Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.

Why was this issue marked with the invalid-reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.

Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

Useful Resources

github-actions[bot] avatar Apr 30 '25 20:04 github-actions[bot]

@tschwartz thank you for providing access to the repo.

I was able to observe the error once but then it wasn't occuring again. How often are you able to reproduce it? I'm not sure how to prioritize this one without consistent reproduction or an example of the error if there is one.

Let us know!

DanRibbens avatar May 01 '25 17:05 DanRibbens

Hello @DanRibbens I am able to reproduce the issue every time using the repro steps provided above. The issue typically will not present itself on the first content block added but rather on every instance thereafter.

tschwartz avatar May 01 '25 17:05 tschwartz

@DanRibbens I have pushed up a minimal repro, removing everything but the pages collection, all extraneous dependencies, etc and am still able to reproduce the issue using the steps above. That said, I am not able to reproduce this with the Payload website template...

tschwartz avatar May 02 '25 15:05 tschwartz

I came here today to report this bug as well. We've noticed it seems to happen only for blocks that would have validation errors such as ones with required fields.

Rybadour avatar Jun 03 '25 14:06 Rybadour

+1, We're experiencing the same issue where the loading animation cycles forever when adding new blocks. For us, this seems to occur much more frequently on macOS compared to Windows. Reloading the page solves the issue temporarily, but only for the first few new blocks before it starts happening again.

peterkunsay avatar Jun 05 '25 09:06 peterkunsay

Is anyone still experiencing this on the latest version v3.72.0?

JessRynkar avatar Jan 20 '26 11:01 JessRynkar

Since we haven’t heard back in a while and this issue relates to several releases ago, we’re going to close it for now. If you’re still seeing this behavior on the latest version (v3.74.0), please let me know and we can re-open this.

JessRynkar avatar Feb 02 '26 18:02 JessRynkar

Can confirm, have not seen in a number of versions. Thank you.

tschwartz avatar Feb 02 '26 18:02 tschwartz

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Feb 10 '26 05:02 github-actions[bot]