Generated with the help of an LLM.

Problem/Motivation

EntityViewOverride builds and publishes against the content's default revision, never the latest one.
On moderated content with a pending draft, publishing an override saves a new default revision from the published content.
The draft's other field changes drop out of the latest revision, and the display goes live without a transition.

Steps to reproduce

  1. Apply an editorial workflow to a content type with an override display enabled.
  2. Publish a node, then save a draft with a changed title.
  3. Open the override builder for that node and publish the display.
  4. The new default revision carries the published title, and the draft is no longer the latest revision.

Proposed resolution

The override builder loads the latest revision, and publishing saves into it without changing its moderation state.
The display then goes live with the content's next transition, made on the content form.

Remaining tasks

  • Narrow MR !552 to this fix, or open a new one.
  • Kernel test that keeps the pending draft through a publish.

User interface changes

None.

API changes

Any signature change the future submodule needs, such as publish() taking a transition, lands here before RC1.
Changing an interface method after RC1 breaks every implementer.

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

The override builder now loads the latest revision, through load_latest_revision on its route and EntityRepository::getActive() for a stored instance, as the content edit form does.
Publishing and reverting then save into the pending draft and leave the live revision alone.

publish() takes an optional ?string $action_id for the content moderation submodule of #3636153: Entity view overrides Content Moderation/Workflow support.
Every plugin in this module throws on a non-NULL action.

prince.wang’s picture

Status: Needs review » Reviewed & tested by the community

Test with content moderation enabled, Builder always working on the lastest revision data and keep current moderation state, no pending draft data loss.

prince.wang’s picture

add publish action support in ApiPublishingController would be a good place in this MR

https://git.drupalcode.org/project/display_builder/-/merge_requests/571/...

mogtofu33’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for testing it with content moderation.

I would keep the controller out of this MR: no plugin accepts an action yet, so reading action from the request would only turn a crafted POST into an error.

Controllers are not API, so the parameter can land with the submodule in #3636153: Entity view overrides Content Moderation/Workflow support after RC1, without a change record.

This MR only freezes the publish() signature before RC1.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • mogtofu33 committed a775f861 on 1.0.x
    fix: #3639104 Override publish overwrites a pending draft revision
    
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.