Skip to content

Maximum update depth exceeded error when using setState inside onCrosshairMove #19

@hyperg3g

Description

@hyperg3g

Any setState call inside onCrosshairMove handler function causes Maximum update depth exceeded error

Even simple examples cause this problem:

const [time, setTime] = useState<MouseEventParams['time']>(undefined)
const onCrosshairMove = (event: MouseEventParams<Time>) => setTime(event.time)

For now the only way I can handle it is by wrapping handler function with debounce with 0 delay

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions