Skip to content

[Brush] onChange is executed after onBrushEnd #1885

Description

@xavi-ortega

When dragging the brush, the onChange callback is triggered several times during the process, which is correct, but when stop dragging an additional onChange event is triggered right after onBrushEnd.

Is this expected? Is there a workaround I can use to know when drag is finished and not receiving any additional input after finishing?

My use case is updating the main app state during onChange, and when drag ends, I want to show a tooltip with the updated state. The issue is that while dragging (onChange) I have a state with a boolean to avoid showing the tooltip until it really ends, which is inconvenient because I set it to false when onBrushEnd is triggered, but it's back to true again when the last onChange runs.

Demo (fork of Brush doc): https://codesandbox.io/p/sandbox/youthful-browser-vq8x4p
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions