core icon indicating copy to clipboard operation
core copied to clipboard

[DEFECT] Update Headless Examples to render Block Editor Contenlets Correctly

Open dario-daza opened this issue 11 months ago • 3 comments

Problem Statement

After the recent backend fix that ensures GraphQL returns full contentlet data inside Block Editor blocks, we have to update the SDK headless examples (Next.js, Angular, and Astro) to the data correctly.

Previously, Block Editor nodes were accessed using:

props.attrs?.data

However, the updated backend response structure now nests the data under:

props.node.attrs?.data

This causes the headless example apps to fail to display contentlets embedded inside Block Editor fields — especially noticeable in blogs or pages using custom blocks.

As a result:

  • Headless apps (Next.js, Angular, Astro) do not render embedded contentlets (e.g., products, cards, custom blocks) inside Block Editor fields.

  • The Inline Editor inside the dotCMS Admin does show the contentlets, creating an inconsistency between inline editing and headless rendering.

  • We need to update all the example apps to read the new structure so they behave consistently with the CMS.

Steps to Reproduce

  1. Set up any of the headless example apps (Next.js, Angular, or Astro).
  2. Create or open a page or blog that contains a Block Editor field.
  3. Insert one or more contentlets (e.g., Product, Author, Card) inside the Block Editor.
  4. View the page in:
    • Headless app (Next.js/Angular/Astro) → embedded contentlets do NOT render.
    • CMS Inline Editor (Admin Panel) → embedded contentlets DO render correctly.
  5. Inspect the SDK component rendering the block:
    • It still reads: props.attrs?.data
    • But backend now provides: props.node.attrs?.data

Acceptance Criteria

  • [ ] Update the Next.js example app to read Block Editor contentlet data using props.node.attrs?.data.
  • [ ] Update the Angular example app to read Block Editor contentlet data using the new schema.
  • [ ] Update the Astro example app to read Block Editor contentlet data using the new schema.
  • [ ] Ensure all examples correctly render contentlets embedded inside Block Editor fields. Verify consistency between:
    • Headless rendering (Next.js / Angular / Astro)
    • CMS Inline Editor view
  • [ ] Add/update documentation or comments explaining the new node.attrs.data structure.

dotCMS Version

Latest

Severity

Low - Minor issue or cosmetic

dario-daza avatar Dec 09 '25 15:12 dario-daza

QA NOTES

Run the dotCMS examples (Angular, Next.js, Astro) and verify that contentlets inside the Block Editor render correctly in both the dotCMS Admin Panel and the example applications.

dario-daza avatar Dec 12 '25 16:12 dario-daza

QA Passed

We changed the code to match the new API Response and the components are rendering correctly

https://github.com/user-attachments/assets/e09e120f-6d87-42a7-899c-adb70d7ceb1e

zJaaal avatar Dec 18 '25 21:12 zJaaal