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

Add callback to useControl hook #1952

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Conversation

Pessimistress
Copy link
Collaborator

For #1949

The issue is that the way the useControl hook calls onCreate and onRemove is not symmetrical. Under <StrictMode>, useEffect is triggered twice, but useMemo is only triggered once. The current DrawControl example adds listeners in onCreate (useMemo), and removes listeners in onRemove (useEffect).

This PR adds a non-breaking new signature to useControl to provide symmetrical add/remove callbacks.

@Pessimistress Pessimistress merged commit 80409dd into master Aug 18, 2022
@Pessimistress Pessimistress deleted the x/control-strict-mode branch August 18, 2022 19:13
Pessimistress added a commit that referenced this pull request Aug 18, 2022
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.

None yet

2 participants