Skip to content

Commit 88eca04

Browse files
committed
use path pattern to crreate path
1 parent 2386e4c commit 88eca04

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/packages/core/workspace/entity-detail/entity-detail-workspace-base.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { UmbSubmittableWorkspaceContextBase } from '../submittable/index.js';
22
import { UmbEntityWorkspaceDataManager } from '../entity/entity-workspace-data-manager.js';
3+
import { UMB_WORKSPACE_PATH_PATTERN } from '../paths.js';
34
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
45
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
56
import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';
@@ -175,10 +176,12 @@ export abstract class UmbEntityDetailWorkspaceContextBase<
175176
protected _checkWillNavigateAway(newUrl: string) {
176177
let willNavigateAway = false;
177178

179+
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
180+
178181
if (this.getIsNew()) {
179-
willNavigateAway = !newUrl.includes(`${this.getEntityType()}/create`);
182+
willNavigateAway = !newUrl.includes(`${workspacePathBase}/create`);
180183
} else {
181-
willNavigateAway = !newUrl.includes(this.getUnique()!);
184+
willNavigateAway = !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
182185
}
183186

184187
return willNavigateAway;

0 commit comments

Comments
 (0)