Skip to content

[Web] Refresh the DOM after a full config replace - #4488

Merged
j-piasecki merged 1 commit into
push-ulsumnxmxtrtfrom
push-zvqnyzkkpoml
Sep 8, 2026
Merged

[Web] Refresh the DOM after a full config replace#4488
j-piasecki merged 1 commit into
push-ulsumnxmxtrtfrom
push-zvqnyzkkpoml

Conversation

@j-piasecki

Copy link
Copy Markdown
Member

Description

resetConfig clears touchAction, userSelect and enableContextMenu, but the DOM was only refreshed when the new config carried one of those keys. resetConfig now marks the DOM as stale and updateGestureConfig flushes it. The web delegate ignores updateDOM before init.

Test plan

Added tests in GestureHandler.test.ts.

## Description

resetConfig clears touchAction, userSelect and enableContextMenu, but the DOM was only refreshed when the new config carried one of those keys. resetConfig now marks the DOM as stale and updateGestureConfig flushes it. The web delegate ignores updateDOM before init.

## Test plan

Added tests in `GestureHandler.test.ts`.
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 206cb9d1-e03d-4d2e-a63c-f538f7b6df95

📥 Commits

Reviewing files that changed from the base of the PR and between 81419f9 and 2b2a85b.

📒 Files selected for processing (3)
  • packages/react-native-gesture-handler/src/web/handlers/GestureHandler.ts
  • packages/react-native-gesture-handler/src/web/handlers/__tests__/GestureHandler.test.ts
  • packages/react-native-gesture-handler/src/web/tools/GestureHandlerWebDelegate.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Fixed web gesture handlers so changes to touch behavior, text selection, and context-menu settings are applied consistently.
    • Fixed configuration resets so previously applied interaction styles are properly cleared.
    • Prevented DOM update attempts before gesture handling is fully initialized, avoiding errors during setup.
  • Tests

    • Added coverage for configuration resets and safe pre-initialization DOM updates.

Walkthrough

Changes

Web DOM synchronization

Layer / File(s) Summary
Delegate initialization guard
packages/react-native-gesture-handler/src/web/tools/GestureHandlerWebDelegate.ts, packages/react-native-gesture-handler/src/web/handlers/__tests__/GestureHandler.test.ts
GestureHandlerWebDelegate sets its initialization state before the first DOM update. Pre-initialization updateDOM() calls now return without applying styles. Tests cover this behavior.
Persistent configuration synchronization
packages/react-native-gesture-handler/src/web/handlers/GestureHandler.ts, packages/react-native-gesture-handler/src/web/handlers/__tests__/GestureHandler.test.ts
GestureHandler tracks pending DOM configuration changes across updates and resets. It invokes delegate.updateDOM() once after applying the changes. Tests verify touch-action reset and delegate invocation.

Suggested reviewers: m-bert

Merge Risk: ⚪ Minimal · up to 2b2a8

Web gesture configuration resets now refresh DOM settings after reconfiguration, while early DOM update requests are safely deferred until initialization. No outstanding merge-readiness risk is evident.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: refreshing the DOM after a full gesture configuration replacement.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@j-piasecki
j-piasecki merged commit 850ff35 into main Sep 8, 2026
8 checks passed
@j-piasecki
j-piasecki deleted the push-zvqnyzkkpoml branch September 8, 2026 06:40
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