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

Fix container subscription leak in strict mode #228

Merged
merged 3 commits into from
Aug 24, 2024

Conversation

albertogasparin
Copy link
Collaborator

@albertogasparin albertogasparin commented Aug 17, 2024

Subscribing on store creation is a problem in StrictMode, as the double triggering of the side effects makes containers resubscribe while we are in cleanup phase.
So we move the Container subscription to the store to a useEffect, which is a recommended pattern anyway, so it would not be triggered as the component is unmounted.

This should be fixing both #225 and #226 as tests for update/destroy were failing with strict mode. Now I've enabled it on most integration tests, adding an util to keep re-renders in check anyway.

cc @hinok @dclark-atlassian

@albertogasparin albertogasparin merged commit 2872ebb into master Aug 24, 2024
2 checks passed
@albertogasparin albertogasparin deleted the fix/container-subscribe branch August 24, 2024 04:31
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

Successfully merging this pull request may close these issues.

1 participant