Node edit form always uses published revision when using content_moderation and workspaces

Created on 14 August 2025, about 21 hours ago

Problem/Motivation

With both content_moderation and workspaces, the node edit form presents the canonical/published revision, not the latest revision.

Steps to reproduce

Expected behavior:
- Create a node and set the initial revision as published.
- Edit the node and set the next revision as un-published.
- Edit the node again.
- Notice that you are editing the latest revision, which is un-published.

Actual behavior:
- With both content_moderation (CM) and workspaces enabled AND the default CM workflow set to apply to all content types:
- Create a node and set the initial revision as published.
- Edit the node and set the next revision as un-published.
- Edit the node again.
- Problem: Notice that you are editing the original, published revision, not the latest revision.

I think this is what is happening:
- When you request /node/1/edit, the route param converter (\Drupal\Core\ParamConverter\EntityConverter::convert) tries to convert the entity ID "1" to the loaded entity.
- Because content_moderation has set that all entities in its workflows use should route param load_latest_revision=true (see \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber::setLatestRevisionFlag), the route param converter tries to load the entity with $this->entityRepository->getActive().
- At this point, Workspaces's (decoration) entity repository service is called (\Drupal\workspaces\WorkspacesEntityRepository::getActive).
- Because there is not an active workspace, this method doesn't load the active revision, e.g., the draft node. Instead, it changes course and loads the canonical revision (getCanonical()). This results in loading the original, published revision of the node, not the latest draft revision.

This behavior seems to have been introduced in πŸ› The active variant of an entity in the Live workspace should be the default revision Active , which is part of core 11.2.

Proposed resolution

I don't know. Is this behavior intentional?

Remaining tasks

API changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.2 πŸ”₯

Component

workspaces.module

Created by

πŸ‡ΊπŸ‡ΈUnited States krisahil

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

Comments & Activities

Production build 0.71.5 2024