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

useFacetEffect will never fire if there are no facet dependencies #88

Open
xaviervia opened this issue Sep 6, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@xaviervia
Copy link
Contributor

Right now, if we run:

useFacetEffect(() => { console.log('I will never fire' }, [], [])

The effect will never fire, because useFacetEffect expects for all facets to resolve to a value before firing the effect. In this case, there are no facets to resolve in the second dependency array, so it will just never fire at all.

In a way this scenario doesn't make sense (we should use useEffect instead) but since there's no way to enforce that empty arrays are not allowed, we should fail gracefully. Instead of never firing, useFacetEffect with an empty facet array should just behave in exactly the same way as a regular useEffect. This, we think, would be the expected behavior.

This issue applies also to a similar scenario in useFacetCallback. We should fix that one as well in the same way.

@xaviervia xaviervia added the bug Something isn't working label Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant