Generated with the help of an LLM.

Problem/Motivation

Selecting a profile on Manage display and saving makes the display render nothing, until someone publishes it in the builder. Every teaser, card or full page using that view mode goes blank on save, listings included.
EntityViewDisplayHook::entityDisplayBuildAlter() replaces the build as soon as the display is enabled, whether or not anything was published. Views displays keep the core render until the first publish.

Steps to reproduce

  1. On a content type's Manage display, open a view mode used by a listing, select a profile, save.
  2. View the listing, or render an entity in that view mode: it is empty.
  3. Publish in the builder: it renders again.

Proposed resolution

Leave the build alone, and the template, while the display has no published sources.

Remaining tasks

  1. Kernel test rendering an enabled, unpublished display.
  2. Fix.
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

Assigned: Unassigned » pdureau
Status: Active » Needs review
pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs review » Reviewed & tested by the community

I have noticed the same yesterday. Thanks you for creating the ticket.

It works well, so RTBC 👍