-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(workbench/view): prevent closing views with a pending
CanClose
…
…guard The router no longer invokes a view's `CanClose` guard if the view is already pending confirmation from a previous close attempt.
- Loading branch information
1 parent
ecd52b3
commit 4326a63
Showing
4 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...src/app/test-pages/blocking-can-close-test-page/blocking-can-close-test-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2018-2024 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Component, inject} from '@angular/core'; | ||
import {WorkbenchView} from '@scion/workbench'; | ||
import {noop} from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'app-blocking-can-close-test-page', | ||
template: 'Blocking CanClose Test Page', | ||
standalone: true, | ||
}) | ||
export default class BlockingCanCloseTestPageComponent { | ||
|
||
constructor() { | ||
inject(WorkbenchView).canClose(() => { | ||
console.debug('[BlockingCanCloseTestPageComponent] BLOCKING'); | ||
return new Promise<boolean>(noop); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters