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

*withState() hooks should clear subject state when no longer used #112

Open
mkrause opened this issue Jan 20, 2025 · 0 comments
Open

*withState() hooks should clear subject state when no longer used #112

mkrause opened this issue Jan 20, 2025 · 0 comments

Comments

@mkrause
Copy link
Collaborator

mkrause commented Jan 20, 2025

In the useModalWithSubject and useOverlayWithSubject hooks, the subject state is kept around even after the modal/overlay is closed. It doesn't cause any particular issues, but it does hold on to an object reference that could otherwise be garbage collected.

Would require something like an onUnmount callback in ModalProvider/PopoverProvider so that the consumer gets notified when the unmount happens and the state can be reset.

@mkrause mkrause changed the title Clear subject state in *withState() hooks? *withState() hooks should clear subject state when no longer used Jan 22, 2025
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

1 participant