Skip to content

Commit 816855f

Browse files
committed
simplify check
1 parent 2baee1c commit 816855f

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

src/packages/data-type/workspace/data-type-workspace.context.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,10 @@ export class UmbDataTypeWorkspaceContext
114114
}
115115

116116
protected override _checkWillNavigateAway(newUrl: string): boolean {
117-
super._checkWillNavigateAway(newUrl);
118-
119-
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
120-
121117
if (this.getIsNew()) {
122-
return !newUrl.includes(`${workspacePathBase}/create`);
118+
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
123119
} else {
124-
return !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
120+
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
125121
}
126122
}
127123

src/packages/language/workspace/language/language-workspace.context.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,10 @@ export class UmbLanguageWorkspaceContext
5656
}
5757

5858
protected override _checkWillNavigateAway(newUrl: string): boolean {
59-
super._checkWillNavigateAway(newUrl);
60-
61-
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
62-
6359
if (this.getIsNew()) {
64-
return !newUrl.includes(`${workspacePathBase}/create`);
60+
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
6561
} else {
66-
return !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
62+
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
6763
}
6864
}
6965

src/packages/user/user/workspace/user/user-workspace.context.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,10 @@ export class UmbUserWorkspaceContext
5656
}
5757

5858
protected override _checkWillNavigateAway(newUrl: string): boolean {
59-
super._checkWillNavigateAway(newUrl);
60-
61-
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
62-
6359
if (this.getIsNew()) {
64-
return !newUrl.includes(`${workspacePathBase}/create`);
60+
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
6561
} else {
66-
return !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
62+
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
6763
}
6864
}
6965

0 commit comments

Comments
 (0)