Initial workspace-published revisions are marked as new too late

Created on 15 September 2025, about 2 months ago

Problem/Motivation

All revisions created in a workspace are marked as new revisions in an entity presave hook (\Drupal\workspaces\Hook\EntityOperations::entityPresave), but that hook is invoked by the entity storage after invoking the ::preSave() method on the entity's fields.

This is problematic for field types that have some logic based on the fact that we're about to save a new revisions, like Entity Reference Revisions: https://git.drupalcode.org/project/entity_reference_revisions/-/blob/8.x...

Steps to reproduce

On a Drupal 11.2 site with Workspaces and Paragraphs enabled, trying to create a new entity that references paragraphs will bump into the exception introduce in 🐛 Disallow saving the current default revision as a non-default revision Active .

Proposed resolution

Ensure that we mark the second revision created by Workspaces for newly-created entities as a new revision in \Drupal\workspaces\Hook\EntityOperations::entityInsert().

Remaining tasks

Review.

User interface changes

Nope.

Introduced terminology

N/A

API changes

Nope.

Data model changes

Nope.

Release notes snippet

N/A

🐛 Bug report
Status

Needs review

Version

11.0 🔥

Component

workspaces.module

Created by

🇷🇴Romania amateescu

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024