From 6adb6e3ff7f93ceca10f4fd5f3c5e8ea4e3a6cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Fri, 28 Jun 2024 12:25:55 +0200 Subject: [PATCH] comment and fixing index --- .../document-blueprint-workspace-editor.element.ts | 10 ---------- .../workspace/document-workspace-editor.element.ts | 3 ++- .../media/workspace/media-workspace-editor.element.ts | 10 ---------- .../workspace/member-workspace-editor.element.ts | 10 ---------- 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace-editor.element.ts index 59411728e2..b4404e770f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace-editor.element.ts @@ -85,17 +85,7 @@ export class UmbDocumentBlueprintWorkspaceEditorElement extends UmbLitElement { component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement, }); - const oldValue = this._routes; - - // is there any differences in the amount ot the paths? [NL] - // TODO: if we make a memorization function as the observer, we can avoid this check and avoid the whole build of routes. [NL] - if (oldValue && oldValue.length === routes.length) { - // is there any differences in the paths? [NL] - const hasDifferences = oldValue.some((route, index) => route.path !== routes[index].path); - if (!hasDifferences) return; - } this._routes = routes; - this.requestUpdate('_routes', oldValue); } private _gotWorkspaceRoute = (e: UmbRouterSlotInitEvent) => { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-editor.element.ts index 584ae703cd..83591487b4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-editor.element.ts @@ -101,7 +101,8 @@ export class UmbDocumentWorkspaceEditorElement extends UmbLitElement { const route = routes.find((route) => route.path === this.#appCulture); if (!route) { - history.pushState({}, '', `${this.#workspaceRoute}/${routes[routes.length - 2].path}`); + // TODO: Notice: here is a specific index used for fallback, this could be made more solid [NL] + history.pushState({}, '', `${this.#workspaceRoute}/${routes[routes.length - 3].path}`); return; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace-editor.element.ts index 247510d0d3..e9ebf9bd2e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace-editor.element.ts @@ -85,17 +85,7 @@ export class UmbMediaWorkspaceEditorElement extends UmbLitElement { component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement, }); - const oldValue = this._routes; - - // is there any differences in the amount ot the paths? [NL] - // TODO: if we make a memorization function as the observer, we can avoid this check and avoid the whole build of routes. [NL] - if (oldValue && oldValue.length === routes.length) { - // is there any differences in the paths? [NL] - const hasDifferences = oldValue.some((route, index) => route.path !== routes[index].path); - if (!hasDifferences) return; - } this._routes = routes; - this.requestUpdate('_routes', oldValue); } private _gotWorkspaceRoute = (e: UmbRouterSlotInitEvent) => { diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member/workspace/member-workspace-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member/workspace/member-workspace-editor.element.ts index 91c2f4abcb..e18cc89526 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member/workspace/member-workspace-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member/workspace/member-workspace-editor.element.ts @@ -87,17 +87,7 @@ export class UmbMemberWorkspaceEditorElement extends UmbLitElement { component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement, }); - const oldValue = this._routes; - - // is there any differences in the amount ot the paths? [NL] - // TODO: if we make a memorization function as the observer, we can avoid this check and avoid the whole build of routes. [NL] - if (oldValue && oldValue.length === routes.length) { - // is there any differences in the paths? [NL] - const hasDifferences = oldValue.some((route, index) => route.path !== routes[index].path); - if (!hasDifferences) return; - } this._routes = routes; - this.requestUpdate('_routes', oldValue); } private _gotWorkspaceRoute = (e: UmbRouterSlotInitEvent) => {