fix: missing dependency in useVideoTexture #1166
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Currently we're using
useVideoTexture
in our application, but when I was trying to control thestart
property on my end, it was not working because the array of dependencies was missing thestart
property. I don't know if it's the right approach to control the behavior of the start property like this, if it's not, just let me know. You can find the sample below (I'll probably change this code, because it's seems redundant, but just so you can understand the scenario):As for the fix, I'm adding the
start
property in the array of dependencies in theuseEffect
.What
I added the
start
property in the array of dependencies in theuseEffect
hook. From my understand, the start property should also have a effect in theuseEffect
, right? If thestart
is false and I want to change it totrue
, the.play
in the useEffect will not run.Checklist