Skip to content

Conversation

@tastydev
Copy link

This fixes a huge bug when depending on state values inside the callback of the frameProcessor. As the frameProcessor had an empty dependency array it always called a stale function identity callback of the worklet which got passed initially.

I.E callback prop calls a function which holds an if clause which depends on a useState value, it has never seen the new useState value if it changed as the new identity/recreated callback function would not be used inside the worklet and frameProcessor.

This fix is important to prevent confusion. I had to debug it for 4 hrs :P

This fixes a huge bug when depending on state values inside the callback of the frameProcessor. As the frameProcessor had an empty dependency array it always called a stale function identity callback of the worklet which got passed initially.

I.E onCallback calls a function which holds an if clause which depends on a useState value it has never seen the new useState value if it changed as the new identity/recreated callback function would not be used inside the Worklet and frameProcessor
@gev2002
Copy link
Owner

gev2002 commented Oct 31, 2024

Hello @tastydev . Thanks for your support of the package, but I can't merge it now, I'll do a review later.

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.

2 participants