payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
23.57k stars 1.5k forks source link

fix (live-preview): populates Lexical - blocks and inline blocks relations are not populated #8275

Open tsemachh opened 1 week ago

tsemachh commented 1 week ago

Link to reproduction

No response

Environment Info

Node.js v22.8.0

Binaries:
  Node: 22.8.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: 9.4.0
Relevant Packages:
  payload: 3.0.0-beta.104
  next: 15.0.0-canary.104
  @payloadcms/db-mongodb: 3.0.0-beta.104
  @payloadcms/graphql: 3.0.0-beta.104
  @payloadcms/live-preview: 3.0.0-beta.104
  @payloadcms/next/utilities: 3.0.0-beta.104
  @payloadcms/plugin-cloud-storage: 3.0.0-beta.104
  @payloadcms/richtext-lexical: 3.0.0-beta.104
  @payloadcms/storage-s3: 3.0.0-beta.104
  @payloadcms/translations: 3.0.0-beta.104
  @payloadcms/ui/shared: 3.0.0-beta.104
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: linux
  Arch: x64
  Version: #44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024
  Available memory (MB): 31817
  Available CPU cores: 8

Describe the Bug

When author enter inline blocks or block if the block has relation field like upload or any other relation. The data in the live preview message does not contain the document of the relation. For now there's a need to call API for each relation and sometimes the live preview is not responding

Reproduction Steps

Clone: https://github.com/tsemachh/payload/tree/bug(live-preview)-LexicalRelationsNotExpanded pnpm dev live-preview Debug on : webpack://_N_E/packages/live-preview/src/traverseRichText.ts?7b26 Add to Test tab to the lexical content media block and see that it doesn't expand it regardless the depth provided Example of debug: image

Adapters and Plugins

No response

tsemachh commented 5 days ago

Actually without this working , we are moving back to regular preview , it's much more solid than this one