Previously, attempting to destroy a view with listeners more than once throws an error during event listener cleanup. This happens because `cleanup` field on the `TView` has already been cleared out by the time the second destruction runs. The `destroyed` flag on LView was previously being set in the `destroyLView` function, but this flag was never _checked_ anywhere in the codebase. This commit moves _setting_ this flag to the `cleanupView` function, just before destroy hooks are called. This is necessary because the destroy hooks can contain arbitrary user code, such as (surprise!) attempting to destroy the view (again). We also add a check to `destroyLView` to skip already-destroyed views. This prevents the cleanup code path from running twice. PR Close #28413
Angular
Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScript and other languages.
Quickstart
Changelog
Learn about the latest improvements.
Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.
Description
Languages
TypeScript
68.6%
HTML
12.8%
JavaScript
8.4%
Pug
7%
Starlark
1.4%
Other
1.7%