Problem/Motivation

Currently if a component is removed or renamed, we throw an error.
In Display builder context this can cause a fatal error, it would be better for builder experience to follow Drupal error message display setting and inform or fail silently with a log.

Steps to reproduce

In Display builder add a component from a module or theme.
Remove or rename this component.

Proposed resolution

Intercept and replace with a status message and a log.
Display status message only if error level is set higher than 'none'.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Status: Active » Needs review
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
pdureau’s picture

Status: Needs review » Needs work

I would advocate to not merge this proposal as it is:

  • it doesn't belong to UI Patterns to add UI element like the proposed status component (especially considering the hardcoded color codes), let's use the Drupal Core status message instead
  • Moreover, the UI element is injected inside the display itself. Let's not mess with the display we are rendering.
  • Catching \Throwable seems too generic and it may not be the role of UI Patterns to handle missing plugins.
mogtofu33’s picture

Status: Needs work » Needs review

it doesn't belong to UI Patterns to add UI element like the proposed status component (especially considering the hardcoded color codes), let's use the Drupal Core status message instead

Problem is that based on the code flow here and how ui patterns interact with SDC, we cannot print anything else than a real component. It's not possible to use a render array like Drupal status which do not integrate yet with SDC, we cannot use an inline template or an empty array, as Drupal\Core\Render\Element\ComponentElement->preRenderComponent() will throw an error.

Moreover, the UI element is injected inside the display itself. Let's not mess with the display we are rendering.

The injection is based on verbosity setting, it print the status on the same level as PHP warning or errors on the page. When "Logging and errors" is set to none, nothing is printed.

Catching \Throwable seems too generic and it may not be the role of UI Patterns to handle missing plugins.

Good catch, I changed the throwable to catch only ComponentNotFoundException.

As for what to do now:

A way longer alternative would be to have something on core, until then we need to address the WSOD here when a simple module with a component used somewhere is disabled.

As for now I don't see a simple way to handle this in a different way.

just_like_good_vibes’s picture

Status: Needs review » Needs work

hello,
the MR is red so i put this to needs work

just_like_good_vibes’s picture

i see the work in this MR is required by display_builder composer.json
i have errors when using display_builder, do we really need that ?