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

untilDestroyed assumes ngDevMode is defined #221

Closed
Patrick-Clausen opened this issue Jan 11, 2023 · 2 comments
Closed

untilDestroyed assumes ngDevMode is defined #221

Patrick-Clausen opened this issue Jan 11, 2023 · 2 comments

Comments

@Patrick-Clausen
Copy link

The untilDestroyed function seems to use the global variable ngDevMode to specify whether it should add a bit of extra debug information.

The implementation of this assumes that ngDevMode is defined, and is either truthy or falsy. However, according to Angular's implementation, it can actually be truthy, falsy or undefined:
https://github.com/angular/angular/blob/main/packages/core/src/util/ng_dev_mode.ts#L24

In some specific setups of Angular applications, this means that any component using the untilDestroyed method can't be instantiated.

Suggest doing a more resilient check, like Angular do themselves:
https://github.com/angular/angular/blob/main/packages/core/src/util/ng_dev_mode.ts#L118

Or simply relying on angular's own isDevMode() method, which does the same thing.

@arturovt
Copy link
Collaborator

Fixed in 9.2.3.

@Patrick-Clausen
Copy link
Author

Impressive turn-around, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants