Skip to content

Brush is reset to initial start and endIndex if useState hook is called via onChange #2672

Description

@leonardofficial
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Create Chart with Brush Component
  2. Call "set method" for a React useState hook from onChange of Brush component

What is expected?

It is expected, that the brush can be moved freely and the value is updated every time the Brush passes a stop on the Axis.

What is actually happening?

The Brush is reset to its initial state as soon as the onChange Method is called, hence after the Brush passes a stop on the Axis. This makes the Brush unusable, since it can only be moved one stop freely before it is reset to its initial state.

Environment Info
Recharts v2.0.8
React react/17.0.2
System Mac OS
Browser Firefox and Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0Issues we need fixed before releasing 3.0bugGeneral bug label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions