Skip to content

Fix reanimated hot reload#3997

Draft
akwasniewski wants to merge 2 commits intomainfrom
@akwasniewski/fix-reanimated-hot-reload
Draft

Fix reanimated hot reload#3997
akwasniewski wants to merge 2 commits intomainfrom
@akwasniewski/fix-reanimated-hot-reload

Conversation

@akwasniewski
Copy link
Contributor

Description

Callbacks object was rebuild on first hot reload while worklets were not, which caused the worklets to reference callback which no longer existed.

Test plan

Tested on the same code as https://github.com/software-mansion/react-native-gesture-handler/tree/%40akwasniewski/fix-reanimated-hot-reload, only commenting the first line.

Copilot AI review requested due to automatic review settings February 25, 2026 13:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a hot reload issue in React Native Gesture Handler where worklets referenced stale callbacks after hot reload. The problem occurred because the callbacks object was rebuilt on hot reload while worklets were not, causing them to reference callbacks that no longer existed.

Changes:

  • Added a didUpdateHandlers flag to track when gesture handlers are updated within a render cycle
  • Modified the rebuild parameter passed to Reanimated's useEvent to include the didUpdateHandlers flag
  • Removed unnecessary blank line for code formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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