-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
reopen: TypeError: Cannot assign to read only property 'tView' of object '[object Object]' #2404
Comments
(I am attempting to work around this with a service, but feel the use case is important either way) |
A small bus service served in place of ngrx here; less than ideal but until freeze is updated to work with ivy this worked |
@pburkindine we fixed the issue of actions coming from NgRx libraries being filtered from immutability checks, but other actions are not, which is probably what you're seeing here. |
@pburkindine did you had the immutability checks on or off in the previous version of NgRx? |
@timdeschryver They've been turned on since we upgraded to ngrx 8 along with A8 last year |
Facing Same Issue @timdeschryver |
Can we have a reproduction of this behavior? |
@timdeschryver I resolved the issue . In my case, this is because of ngrx-Store-freeze. |
The problem is that a component is being dispatched as meta data on the action. I'm just not sure if we should change this behavior. |
This can be happend when using "[(ngModel)]" |
@curiouscod3 the example you posted does indeed throw an error but it's unrelated to this issue. |
This error happens to me in v8 and v9 when using the Is this a known issue, or do I need to change something? Any tips to diagnose this would be greatly appreciated. The stack trace doesn't seem to help much. Update: I was storing a list of the last x number of actions in my state in a demo app, which included router actions. I have now filtered out the It sure would be helpful if there was more debugging info in the error so you could quickly find what needs to be changed to keep from violating the immutability checks. |
Hi, @timdeschryver I generally understand this response, although in our case passing a component was much less problematic than passing a string. (Passing a string would require us at a minimum to maintain a map of loadable components that we didn't have to keep up with before; this is dozens of components and changing all the time, etc etc.) But I'm fine with doing the same thing with a bus service. I guess my only ask would be that ngrx enforce this restriction or add helpful error messaging as figuring this out was pretty tough and it's a common-enough scenario Thanks, |
Hi @pburkindine, From what I can tell, the issues come in when you're dispatching an action not owned by an NgRx library that contains a component, with immutability checks enabled. I see a couple of potential options here.
Thoughts? cc: @timdeschryver |
@brandonroberts I was hoping we shouldn't have to check for ivy components. |
@timdeschryver I agree with your hesitation with the exclude function. I agree that passing components through the store if you're also needed to replay/rehydrate the state will cause weird behavior. I also think Ivy components are an exception to the rule as they are provided by the upstream framework. If its outside of that use case, I would recommend using a different mechanism to pass components around. |
Hi @brandonroberts, Thanks for the reply! The first option seems reasonable to me as it will be totally transparent versus a flag, hard to think of a scenario where someone would be passing a class through state post-Ivy where this wouldn't be "vanilla". In a more general way it's hard for me to think of a reason to make a class immutable in state (in modern TS land, why would you be messing with the class itself?). (I guess theoretically someone would mutate a prototype and screw up another consumer? Would the store prevent that?). So you could make the argument that references to classes should be totally exempt from immutability in general (from my 20,000ft not-involved POV). |
Hello. Q: I wonder how to get strictStateImmutability runtime check benefits with Ivy? At this time our app has runtime check OFF Ref: https://ngrx.io/guide/store/configuration/runtime-checks |
Hi!, Currently working in a ngrx-firebase project, dependencies like this:
Getting these error as soon as a valid user logs in:
and
The only way to get rip off these above is to turn off runtime checks as indicated here https://ngrx.io/guide/store/configuration/runtime-checks |
I have the same issue. I am also using angularfire. I did have the issue with saving User object in store. The way I solved it was to get specific properties from User returned by firebase api and write them to my User object. and only afterwards pass it to success action. Now I got the same error when I am trying to save AngularFireUploadTask-s in store. I decided to disable the runetime-checks, but I do want to avoid it. any solutions to this issue? I don't want to copy and pick properties from the AngularFireUploadTask object, similarly to what I did with User object, but that might solve the issue once again. |
revisiting: #2109
@brandonroberts @AndrewKushnir I am still experiencing this error in A9. I have tried disabling both strictState and strictAction, and also upgrading to [email protected]
Our use case is this: various nx modules are passing a Type through state to the app.component, where the component is factoried into a MatSidenavContainer. (not routing-related but same error)
I also tried passing the factory instead and received a similar error.
Please let me know what information I can provide.
The text was updated successfully, but these errors were encountered: