You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Versions (please complete the following information):
NgxWebstorage: 19.0.1
Angular: 19.1.3
Describe the bug
Current Angular CLI on create sets target = es2022. This implies useDefineForClassFields = true.
Decorators like @LocalStorage are not working in this scenario
To Reproduce
Steps to reproduce the behavior:
Create a new Angular app.
Try to use @LocalStorage decorator
It will always read undefined
Expected behavior
Read the value from local storage
Additional context
You can fix it by setting useDefineForClassFields = false. A good explanation of this feature (and why it should be set to true) is here.
I didn't really check in deep yet but I believe it has to do something with #esbuild/2220
I see that Angular now migrates to signals. See for example here. I think they're planning to get rid of decorators at least for class fields.
Maybe ngx-webstorage can also suggest something like this? You can even provide ChangeDetectorRef and support push also
The text was updated successfully, but these errors were encountered:
Versions (please complete the following information):
Describe the bug
Current Angular CLI on create sets
target = es2022
. This impliesuseDefineForClassFields = true
.Decorators like
@LocalStorage
are not working in this scenarioTo Reproduce
Steps to reproduce the behavior:
@LocalStorage
decoratorExpected behavior
Read the value from local storage
Additional context
You can fix it by setting
useDefineForClassFields = false
. A good explanation of this feature (and why it should be set to true) is here.I didn't really check in deep yet but I believe it has to do something with #esbuild/2220
I see that Angular now migrates to signals. See for example here. I think they're planning to get rid of decorators at least for class fields.
Maybe ngx-webstorage can also suggest something like this? You can even provide
ChangeDetectorRef
and support push alsoThe text was updated successfully, but these errors were encountered: