Switching workspaces shouldn't clear the persistent entity cache

Created on 27 June 2025, 10 days ago

Problem/Motivation

πŸ› Entity queries for latest revisions should return the latest workspace-specific revisions Postponed: needs info introduced a performance regression: the persistent entity cache is cleared when switching workspaces because that issue needed to reset the static cache for the latest revision IDs.

Steps to reproduce

- enable the Workspaces module
- create a node and view it
- navigate away from the node view page, activate a workspace and check the cache_entity table -> there are no entries for that node

Proposed resolution

Change ContentEntityStorageBase to store the latest revision IDs in memory cache, so they can be easily cleared from \Drupal\workspaces\WorkspaceManager::doSwitchWorkspace().

An additional performance improvement is to ensure that WorkspaceManager::executeInWorkspace() and WorkspaceManager::executeOutsideWorkspace() are not switching workspaces unnecessarily.

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

Active

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024