Entity view alter removes needed properties from build array

Created on 4 June 2024, 21 days ago

Problem/Motivation

First, thanks for the amazing work thus far! We have been working extensively with SDC in general with our site building process that leverages Layout Paragraphs β†’ and Mercury Editor β†’ . Both of those modules add properties to the build array that are required for functionality, including attached libraries, attributes, and pre-/post-render objects.

When enabling SDC Display and attempting to map field values to props and slots, we encountered lots of issues that prevented Layout Paragraphs from functioning correctly (and by extension, Mercury Editor). If we used vanilla Paragraphs, things seemed to work fine.

Steps to reproduce

  • Enable Paragraphs, Layout Paragraphs, and SDC Display.
  • Create a Paragraph type with some fields.
  • Create a content type with a Paragraph reference field, and ensure the newly-created Paragraph can be added.
  • Create a component with props/slots to display the fields from the Paragraph type.
  • Edit the display of the Paragraph type, render using the component, and map the fields from the Paragraph type to the props in the component.
  • At this point, the Paragraph should render using the component, and it should be editable.
  • Switch the Paragraph reference field on the content type to use Layout Paragraphs in the display and the form display.
  • Now you should be able to add a new Paragraph to the page, but weirdness happens if you save the node, and the editor controls for Layout Paragraphs do not appear so content cannot be edited.

Proposed resolution

This seems to happen because many existing properties in the build array are obliterated in sdc_display_entity_view_alter(). Propose leaving the build array as it stands, and only altering it by inserting the component props and slots, and removing fields that have been mapped to those props/slots.

Remaining tasks

The submitted MR endeavors do provide that resolution, but it has definitely not been tested across a variety of scenarios. It seemed to make Layout Paragraphs more compatible with SDC Display, but this approach may introduce new trouble with other modules or build approaches.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States sethhill

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024