Skip to content

Commit 279409d

Browse files
nielslyngsoeiOvergaardCopilot
authored
Fix: Workspace Editor slotted fallback content should be displayed when no routes (#20006)
* fix + notes * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Jacob Overgaard <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent f0c5ecf commit 279409d

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export class UmbWorkspaceEditorContext extends UmbContextBase {
3838
(view) => !workspaceViews.some((x) => x.manifest.alias === view.manifest.alias),
3939
);
4040

41-
const diff = viewsToKeep.length !== workspaceViews.length;
41+
const hasDiff = viewsToKeep.length !== workspaceViews.length;
4242

43-
if (diff) {
43+
if (hasDiff) {
4444
const newViews = [...viewsToKeep];
4545

4646
// Add ones that are new:

src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-editor/workspace-editor.element.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,26 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
136136
}
137137

138138
override render() {
139-
return this._routes
140-
? html`
141-
<umb-body-layout main-no-padding .headline=${this.headline} ?loading=${this.loading}>
142-
${this.#renderBackButton()}
143-
<slot name="header" slot="header"></slot>
144-
<slot name="action-menu" slot="action-menu"></slot>
145-
${this.#renderViews()} ${this.#renderRoutes()}
146-
<slot></slot>
147-
${when(
148-
!this.enforceNoFooter,
149-
() => html`
150-
<umb-workspace-footer slot="footer" data-mark="workspace:footer">
151-
<slot name="footer-info"></slot>
152-
<slot name="actions" slot="actions" data-mark="workspace:footer-actions"></slot>
153-
</umb-workspace-footer>
154-
`,
155-
)}
156-
</umb-body-layout>
157-
`
158-
: nothing;
139+
// Notice if no routes then fallback to use a slot.
140+
// 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]
141+
return html`
142+
<umb-body-layout main-no-padding .headline=${this.headline} ?loading=${this.loading}>
143+
${this.#renderBackButton()}
144+
<slot name="header" slot="header"></slot>
145+
<slot name="action-menu" slot="action-menu"></slot>
146+
${this.#renderViews()} ${this.#renderRoutes()}
147+
<slot></slot>
148+
${when(
149+
!this.enforceNoFooter,
150+
() => html`
151+
<umb-workspace-footer slot="footer" data-mark="workspace:footer">
152+
<slot name="footer-info"></slot>
153+
<slot name="actions" slot="actions" data-mark="workspace:footer-actions"></slot>
154+
</umb-workspace-footer>
155+
`,
156+
)}
157+
</umb-body-layout>
158+
`;
159159
}
160160

161161
#renderViews() {
@@ -213,7 +213,7 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
213213
}
214214

215215
#renderRoutes() {
216-
if (!this._routes || this._routes.length === 0) return nothing;
216+
if (!this._routes || this._routes.length === 0 || !this._workspaceViews || this._workspaceViews.length === 0) return nothing;
217217
return html`
218218
<umb-router-slot
219219
inherit-addendum

0 commit comments

Comments
 (0)