Skip to content

Bug: Re-rendering nested components breaks event listeners on parent #27618

@greebl3

Description

@greebl3

Re-rendering nested components breaks event-handlers; wrapping handler functions in useCallback makes no difference

React version: 18.2

Link to code example: https://codesandbox.io/s/re-rendering-breaks-event-listener-2dxjhz

Note: The repro makes use of Touch events, so open the Sandbox link on a mobile device

The current behavior

onTouchEnd does not fire when re-rendering a nested component, even when caching handler-functions with useCallback

The expected behavior

Re-rendering a nested component should have no effect on its parent's event-listeners

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions