Merge pull request #1501 from umbraco/bugfix/invariant-workspace-url

Bugfix: Invariant workspace url
This commit is contained in:
Niels Lyngsø
2024-03-27 11:28:48 +01:00
committed by GitHub

View File

@@ -98,8 +98,14 @@ export class UmbDocumentWorkspaceEditorElement extends UmbLitElement {
routes.push({
path: '',
resolve: () => {
// Retrieve the current app language variant id from the context and redirect to the correct route.
history.pushState({}, '', `${this.#workspaceRoute}/${this.#appCulture}/${this.#variants![0].unique}`);
const route = routes.find((route) => route.path === this.#appCulture);
if (!route) {
history.pushState({}, '', `${this.#workspaceRoute}/${routes[routes.length - 2].path}`);
return;
}
history.pushState({}, '', `${this.#workspaceRoute}/${route?.path}`);
},
});
}