Skip to content

[Web] Attach handlers in the handlerTags order instead of creation order#4193

Open
j-piasecki wants to merge 3 commits into
mainfrom
@jpiasecki/fix-web-attach-order
Open

[Web] Attach handlers in the handlerTags order instead of creation order#4193
j-piasecki wants to merge 3 commits into
mainfrom
@jpiasecki/fix-web-attach-order

Conversation

@j-piasecki
Copy link
Copy Markdown
Member

Description

#4179 changed how gestures are attached to the host detector. This resulted in handlers being attached in the creation order instead of the order in handlerTags like before. This didn't have an impact on Android/iOS, but the web turned out to be specifically sensitive to this.

While the sensitivity to the attach order needs to be investigated, this PR restores the previous behavior by batching the response to the gesture-ready callbacks and attaching all prepared handlers based on the handlerTags order.

Test plan

Test the web example app, especially Nested Pressables.

Copilot AI review requested due to automatic review settings May 25, 2026 06:29
Copy link
Copy Markdown
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

Restores deterministic gesture-handler attachment ordering on web by batching NodeManager.observeHandler “ready” callbacks into a single microtask flush, so handlers are attached in handlerTags (subscription) order rather than React effect creation order (regression introduced in #4179).

Changes:

  • Batch handler-ready observer callbacks via a microtask and attach all ready handlers in one flush.
  • Refactor attach flow to attach/update top-level and virtual handlers from stored subscriptions.
  • Simplify syncSubscriptions API and observer callback wiring to route through the batched flush.

💡 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