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
When we have multiple iframes with the same origin, we can share objects between different iframe window. But immer produce has a check isPlainObject(), there is a condition "Object.getPrototype(xxx) === Object.prototype", which makes this scenario broken. Because the window.Object.prototype in different iframes have different instances. This condition will return false.
The basic repro example is:
in iframe, we can set window.parent.test = {a: 1} (this can work when iframe and parent have same origin)
in parent window, we can access window.test and produce(window.test, (draft) => { } ), but this action will get exception "Not a plain object"
Can we change the condition "Object.getPrototype(xxx) === Object.prototype" in the function isPlainObject() ?
The text was updated successfully, but these errors were encountered:
atvoid
changed the title
Not working when produce object across iframes
Produce is not working when produce object across iframes
Mar 15, 2021
atvoid
changed the title
Produce is not working when produce object across iframes
Not working when produce object across iframes
Mar 15, 2021
atvoid
changed the title
Not working when produce object across iframes
Not working when "produce()" object across iframes
Mar 15, 2021
When we have multiple iframes with the same origin, we can share objects between different iframe window. But immer produce has a check isPlainObject(), there is a condition "Object.getPrototype(xxx) === Object.prototype", which makes this scenario broken. Because the window.Object.prototype in different iframes have different instances. This condition will return false.
The basic repro example is:
in iframe, we can set window.parent.test = {a: 1} (this can work when iframe and parent have same origin)
in parent window, we can access window.test and produce(window.test, (draft) => { } ), but this action will get exception "Not a plain object"
Can we change the condition "Object.getPrototype(xxx) === Object.prototype" in the function isPlainObject() ?
The text was updated successfully, but these errors were encountered: