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

Keep useFacetCallback instance same even if facets instances change #119

Merged
merged 4 commits into from Mar 24, 2023

Conversation

vb
Copy link
Contributor

@vb vb commented Mar 16, 2023

  • This PR refactors the callback (useCallback) returned from useFacetCallback
  • Previously, the callback had the facets (originally passed to useFacetCallback) in its dependency array, meaning it would return a new instance of the callback when the facets were modified
  • This PR removes the facets from the dependency array and instead puts them in a ref.
  • The callback then reads from the ref to get the current facet values

@vb vb requested a review from pirelenito March 16, 2023 10:56
@vb vb merged commit 6c9913c into main Mar 24, 2023
@vb vb deleted the keep-callback-instance-same branch March 24, 2023 08:24
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