-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Immer is modifying baseObject and not throwing exception for nested un-draftable objects. #890
Comments
That is working as expected, if a class is not marked immerable, it behaves like it would normally do in JavaScript. The fact that it is referred to by a draft is unrelated to that. |
See also #686, we could warn more explicitly about this, just not landed it so far for the impact it will have. |
Thanks for the clarification. |
🐛 Bug Report
Based on the documentation, object of type 'class' needs to have [immerable] set to true to be handled.
When [immerable] is not set, it should throw an exception.
However, if the baseObject is plain javascript/(class with immerable set to true) and the nested object is un-draftable(class without immerable), then the baseObject itself is modified and returned without exception.
Link to repro
https://codesandbox.io/s/immer-sandbox-error-forked-rry8q
Observed behavior
BaseObject is modified and returned. No exception is thrown.
Expected behavior
Exception should be thrown.
Environment
We only accept bug reports against the latest Immer version.
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: