Comments (20)
Even trying that approach it fails:
function UntilDestroy(options = {}) {
return (type: unknown) => {};
}
@UntilDestroy()
@Component({
...
So at least, this is not related to this library ;)
from until-destroy.
Could you please provide a minimal reproducible example?
from until-destroy.
Closing as not reproducible. We have an integration app in this repository which is running with Angular 15.
Feel free to re-open the issue once you're able to provide a reproducible example.
from until-destroy.
Got the same issue, same fix. No idea what's going on. I'm not able to reproduce it on stackblitz...
from until-destroy.
Got the same issue after migration to angular 15.
from until-destroy.
I saw that the repo was upgraded to angular 15. Could we get a new release? Maybe this fix the issue.
from until-destroy.
Well, I could’ve published a new version but I’d want to double check to ensure this is related to a new version. Because that might be an unnecessary publish. I need a reproducible example gentlemen.
from until-destroy.
Could you publish a dev version so that I can check against my project?
from until-destroy.
I'm using Angular v15, and I don't have an issue. It'll be helpful if you can reproduce it.
from until-destroy.
I have had something similar since the upgrade to Angular 15.
We have a use case where we want to get a MatFormFieldControl
from a ControlValueAccessor
component implementing the MatFormFieldControl
that is injected using the Content Projection.
@ContentChild(MatFormFieldControl, { static: true })
private formFieldControl!: MatFormFieldControl<unknown>;
ngOnInit(): void {
this.matFormField._control = this.formFieldControl;
For MatFormFieldControl
components that have the UntilDestroy()
decorator, the this.formFieldControl
is empty
When you remove the decorator, it works well again.
I'll try to provide a reproducible case today
from until-destroy.
I was not able to reproduce our issue on a clean project TBH.
We are still investigating why it is failing by removing all codes around.
Even if I remove the code within the decorator it is failing.
Just the fact that we set the decorator has an impact on our @ContentChild
reaction.
I think this is related to angular/angular#48276 but no idea what is the reason.
from until-destroy.
To be honest I have issues in other libraries as well related to decorators. But it’s usually not a library issue but something related to the application.
Since I’ve seen already some issues related to decorators this means there actually has been some change in the TS compiler or Angular compiler that might affect it.
from until-destroy.
this typescript issue seems to be related
from until-destroy.
It is indeed related to a modification of the way properties are set as you can see in the Typescript documentation. This new way is applied when your target is es2022.
Angular cli is aware of this as you can this in this code , it will set the correct value
The solution then is to set the target to es2021 then Angular Cli will hook the configurations and set es2022 and useDefineForClassFields to false
There is only one thing that we still don't understand is that if you set these values yourself to avoid the warning of Angular Cli, then it doesn't work. It seems typescript will read directly the file and just ignore useDefineForClassFields
Related tickets:
from until-destroy.
Yeah, I haven't got my hands yet to going through the Angular 15 release completely. In other libraries this is being solved by playing around with useDefineForClassFields
.
from until-destroy.
Have to re-open the issue because I also experienced it in one of my apps (haven't met it earlier):
Error: NG0204: Token InjectionToken NgValueAccessor is missing a ɵprov definition.
Not sure how to fix it yet, will be looking for possible resolutions.
UPD: I ain't sure this is exactly related to this library.
from until-destroy.
@jogelin I have experienced this issue with a control value accessor too. I have fixed it with the forwardRef
.
Before:
provide: NG_VALUE_ACCESSOR,
useExisting: CosAutocompleteComponent
After:
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => CosAutocompleteComponent),
Your thoughts?
P.S. I know it wasn't necessary to use forwardRef
since Ivy has been released (because component definition appeared after the class itself, thus there has been no reason to "capture" the class reference).
from until-destroy.
Ok, I just doubled checked my app and the issue wasn’t related to this library. Sorry for pinging anyone who’s subscribed to this issue.
from until-destroy.
@jogelin I have experienced this issue with a control value accessor too. I have fixed it with the
forwardRef
.Before:
provide: NG_VALUE_ACCESSOR, useExisting: CosAutocompleteComponentAfter:
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CosAutocompleteComponent),Your thoughts?
P.S. I know it wasn't necessary to use
forwardRef
since Ivy has been released (because component definition appeared after the class itself, thus there has been no reason to "capture" the class reference).
Seems to work too :)
from until-destroy.
I'm still able to reproduce the issue in Angular v15.2. Though, I'm not sure if I have to follow this approach #224 (comment)
from until-destroy.
Related Issues (20)
- Add a util cancel Promises
- Angular 14 ut could not run correctly HOT 1
- Angular 14 ut could not run correctly with a minimal reproducible example
- Angular 14 ut could not run correctly with a a minimal reproducible example HOT 7
- Can I ask what's the utility for this package?
- How to use until-destroy-migration? HOT 4
- Angular 15 Directive Composition API: Cannot access [component] before initialization. HOT 4
- [Documentation] For using `untilDestroyed` in non Angular apps HOT 1
- untilDestroyed assumes ngDevMode is defined HOT 2
- Warnings for github actions builds
- Component is undefined if @UntilDestroy() is used HOT 2
- Supporting other types of Subscriptions HOT 1
- Support TS 5.0 non experimental decorators for the UntilDestroy decorator
- ERROR Error: ASSERTION ERROR: token must be defined [Expected=> null != undefined <=Actual] HOT 5
- Angular 16 takeUntilDestroyed HOT 7
- Need upgrade for Angular 17 HOT 2
- Debugger in source code
- Error when using Target 2022 - Similar issue link provided HOT 9
- Use decorator with Singleton service (providedIn: 'root') HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from until-destroy.