diff --git a/core/modules/workspaces/src/EntityQuery/QueryTrait.php b/core/modules/workspaces/src/EntityQuery/QueryTrait.php
index 336b656c7305cef0b16c62a15502816940af8c4d..2630d9e9ee820fbdc7f15b999449240fa3198312 100644
--- a/core/modules/workspaces/src/EntityQuery/QueryTrait.php
+++ b/core/modules/workspaces/src/EntityQuery/QueryTrait.php
@@ -54,7 +54,7 @@ public function prepare() {
 
     // Only alter the query if the active workspace is not the default one and
     // the entity type is supported.
-    if ($this->workspaceManager->hasActiveWorkspace() && $this->workspaceManager->isEntityTypeSupported($this->entityType)) {
+    if ($this->workspaceManager->isEntityTypeSupported($this->entityType) && $this->workspaceManager->hasActiveWorkspace()) {
       $active_workspace = $this->workspaceManager->getActiveWorkspace();
       $this->sqlQuery->addMetaData('active_workspace_id', $active_workspace->id());
       $this->sqlQuery->addMetaData('simple_query', FALSE);