-
Notifications
You must be signed in to change notification settings - Fork 813
Failed removeChild function for parent when parentSelector is changed #769
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
Comments
@roman-mateush Can you make a reproducible example, please? |
@roman-mateush Perhaps, you can change back the modal to the previous element before you leave fullscreen mode...or let me know if found a way to fix this. |
This happens for me too. I am on // OuterParent -> Parent -> Modal
const OuterParent = props => props.show && (<Parent />)
function Parent() {
const root = useRef(null);
return (
<div ref={root}>
<Modal parentSelector={() => root.current}
</div>
);
} When the Parent is unmounted from Because the Parent is already unmounted and returns I had to use a hack as a temp fix parentSelector={() => {
return this.root.current || {removeChild: () => {}}
}} Perhaps add a sanity check to const parent = getParentElement(this.props.parentSelector);
if (parent) parent.removeChild(this.node); |
@heshan0131 Additionally to More infoThe reason this exception will raise is that react-modal schedules the removing of the modal on |
Hi, I've updated to v3.11.1 and I'm still getting this error. Here's what my set up looks like:
I was able to resolve it with the temp hack above but it seems like upgrading to v3.11.1 would've resolved it without the hack. Is there any additional setup I need to change? Any help would be greatly appreciated, thanks! |
Just so that no one who arrives here is confused by a typo in the above comment, |
Hi guys
In our project when we have player in fullscreen mode we want to show some modals on user actions. For showing modal in fullscreen I use
parentSelector
to change parent from body to player component. But when user leaves player in fullscreen mode with opened modal I get some errorbecause parent doesn't exist anymore (player) and removeChild function fails
Can be it fixed somehow? Thank you!
The text was updated successfully, but these errors were encountered: