Skip to content
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

Props stay the same when InPortal content is hidden #35

Open
ARival opened this issue Mar 20, 2022 · 3 comments
Open

Props stay the same when InPortal content is hidden #35

ARival opened this issue Mar 20, 2022 · 3 comments

Comments

@ARival
Copy link

ARival commented Mar 20, 2022

We use an Intersection Observer to determine whether a video is in view and to render it. The problem arises when the video leaves all OutPortals: it maintains the props that it received before going back 'into hiding', so inView prop never gets set to false and

Is there a way to force the detached component to revert back to default props whenever it is hidden? Or some sort of workaround? I'm just looking for any way for the component to have state that triggers when it is detached from the DOM.

@pimterry
Copy link
Member

Hi, can you share a repro of the issue so I can see it for myself?

I'm not totally clear, but it sounds like this is a bug, since leaving the OutPortal should indeed reset props to their original state. A repro would be very helpful to confirm that. If you've already found the cause, a PR to fix this would also be very welcome!

@ARival
Copy link
Author

ARival commented Mar 21, 2022

Hey there! If I get some bandwidth, I'll try to set up a project with a repro.

I'm diving into the code to as well to see if there's anything obvious to fix.

@adri1wald
Copy link
Contributor

adri1wald commented Jul 11, 2022

Hey there, I've encountered the same issue. It's because nothing in <OutPortal/> calls node.setPortalProps on unmount.

Edit: I've created a PR with an initial implementation of portal prop resetting. Let me know what you think! #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants