From 279409d6eee1f610500cd57d855bffc3d86bc4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 27 Aug 2025 13:09:21 +0200 Subject: [PATCH] Fix: Workspace Editor slotted fallback content should be displayed when no routes (#20006) * fix + notes * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../workspace-editor.context.ts | 4 +- .../workspace-editor.element.ts | 42 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.context.ts index dd916b5a2e..e1c3724876 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.context.ts @@ -38,9 +38,9 @@ export class UmbWorkspaceEditorContext extends UmbContextBase { (view) => !workspaceViews.some((x) => x.manifest.alias === view.manifest.alias), ); - const diff = viewsToKeep.length !== workspaceViews.length; + const hasDiff = viewsToKeep.length !== workspaceViews.length; - if (diff) { + if (hasDiff) { const newViews = [...viewsToKeep]; // Add ones that are new: diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.element.ts index 499278f5d1..10866294c8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.element.ts @@ -136,26 +136,26 @@ export class UmbWorkspaceEditorElement extends UmbLitElement { } override render() { - return this._routes - ? html` - - ${this.#renderBackButton()} - - - ${this.#renderViews()} ${this.#renderRoutes()} - - ${when( - !this.enforceNoFooter, - () => html` - - - - - `, - )} - - ` - : nothing; + // Notice if no routes then fallback to use a slot. + // TODO: Deprecate the slot feature, to rely purely on routes, cause currently bringing an additional route would mean the slotted content would never be shown. [NL] + return html` + + ${this.#renderBackButton()} + + + ${this.#renderViews()} ${this.#renderRoutes()} + + ${when( + !this.enforceNoFooter, + () => html` + + + + + `, + )} + + `; } #renderViews() { @@ -213,7 +213,7 @@ export class UmbWorkspaceEditorElement extends UmbLitElement { } #renderRoutes() { - if (!this._routes || this._routes.length === 0) return nothing; + if (!this._routes || this._routes.length === 0 || !this._workspaceViews || this._workspaceViews.length === 0) return nothing; return html`