react-reverse-portal icon indicating copy to clipboard operation
react-reverse-portal copied to clipboard

Since updating to Immer 10.1.2 react-reverse-portal no longer works

Open ccapndave opened this issue 2 months ago • 2 comments

A recent version of Immer has implemented this change:

https://github.com/immerjs/immer/pull/1069

Since then, my component is throwing this error when mounting InPortal:

Renderable.tsx:24 TypeError: Cannot assign to read only property 'setPortalProps' of object '#<Object>'
    at Object.assign (<anonymous>)
    at InPortal2._this.addPropsChannel (react-reverse-portal.js?v=4b696a38:114:16)
    at InPortal2.componentDidMount (react-reverse-portal.js?v=4b696a38:126:12)

ccapndave avatar Sep 04 '25 07:09 ccapndave

I don't know much about Immer I'm afraid. Open to suggestions or PRs on ways to improve compatibility with this, but react-reverse-portal does need to track & mutate internal state shared between various different components outside of the normal pure React props/state flow. Somehow the in portal needs to transparently pass data up through the node, and back down to the out portal.

pimterry avatar Sep 05 '25 17:09 pimterry

Thanks @pimterry - I have added an issue in Immer in case someone cleverer than me can offer some advice.

ccapndave avatar Sep 11 '25 07:09 ccapndave