Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifecycle hook wbBeforeDestroy is not called for views of lazily loaded modules #27

Closed
danielwiehl opened this issue Oct 24, 2018 · 2 comments

Comments

@danielwiehl
Copy link
Collaborator

danielwiehl commented Oct 24, 2018

Current behavior

Lifecycle hook wbBeforeDestroy is not called for views of lazily loaded modules.

Also, the title and heading are not set if they are configured on the route.

Expected behavior

Lifecycle hook is called.

Minimal reproduction of the problem with instructions

  1. Create a lazily loaded module
  2. Create a view in that module
  3. Implement lifecycle hook wbBeforeDestroy in that view
  4. Close the view

Environment

  • SCION Workbench version: 0.0.0-beta.10
  • Angular version: 6.0.2
@mofogasy
Copy link
Contributor

This problem might be related to angular/angular#28730

@danielwiehl danielwiehl added this to Backlog in SCION Jun 21, 2020
@danielwiehl danielwiehl moved this from Backlog to Bug Reports in SCION Jun 23, 2020
@danielwiehl danielwiehl moved this from Backlog to Triage in SCION Jan 22, 2021
@danielwiehl
Copy link
Collaborator Author

The workbench installs a CanDeactivate guard to prevent a view from being closed.

This currently leads to the following problems:

  • The guard is not invoked for certain route configurations (works for component and loadComponent, but not for children and loadChildren).
  • The workbench router must perform a separate navigation for each view that is to be closed. Otherwise, the entire navigation would be canceled if some view(s) prevent closing. In addition, the separate navigations each cause an entry in the browsing history.

We should consider a different approach to prevent views from closing.

danielwiehl added a commit that referenced this issue May 2, 2024
To fix issues related to preventing views from closing, the guard is no longer implemented as an Angular "CanDeactivate" guard but runs before the Angular navigation.

This commit fixes the following issues:
- guard now also runs on child routes
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed.
- the guard can perform an Angular navigation, e.g., display a message box with route content.

closes #27, closes #344

BREAKING CHANGE: Interface and method for intercepting (or preventing) closing of a view has changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippets illustrate how a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 4, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also works on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also works on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 7, 2024
The following issues have been fixed:
- `CanClose` guard now also works on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
@danielwiehl danielwiehl mentioned this issue May 7, 2024
17 tasks
SCION automation moved this from Triage to Done May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
SCION
  
Done
Development

No branches or pull requests

2 participants