Skip to content

Commit 20a554c

Browse files
committed
don't hard code path checks
1 parent 0909c37 commit 20a554c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export class UmbLanguageWorkspaceContext
3333
{
3434
path: 'create',
3535
component: UmbLanguageWorkspaceEditorElement,
36-
setup: async () => {
36+
setup: async (_component, info) => {
37+
this._setActivePathSegment(info.match.fragments.consumed);
3738
this.create({ parent: { entityType: UMB_LANGUAGE_ROOT_ENTITY_TYPE, unique: null } });
3839

3940
new UmbWorkspaceIsNewRedirectController(
@@ -49,19 +50,12 @@ export class UmbLanguageWorkspaceContext
4950
setup: (_component, info) => {
5051
this.removeUmbControllerByAlias('isNewRedirectController');
5152
this.load(info.match.params.unique);
53+
this._setActivePathSegment(info.match.fragments.consumed);
5254
},
5355
},
5456
]);
5557
}
5658

57-
protected override _checkWillNavigateAway(newUrl: string): boolean {
58-
if (this.getIsNew()) {
59-
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
60-
} else {
61-
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
62-
}
63-
}
64-
6559
setName(name: string) {
6660
this._data.updateCurrentData({ name });
6761
}

0 commit comments

Comments
 (0)