Skip to content

zIndex property doesn't like to be changed in quick succession #6789

Description

@joaovfabri

What is the current behavior?

With slight adaptations to the Legend with Opacity example, if you hover the legend items in quick succession, curves will start disappearing from the chart (and also from the DOM).

Screen.Recording.2025-12-17.at.09.27.34.mov

It seems to happen when a dynamic zIndex is added, which leads me to believe it's a internal bug.
The issue can be much more critical if more curves are added or more complex configuration is used, to the point where moving away from the plot does not cause the curve to be re-rendered.

*Bonus: animations seem broken like in here

What is the expected behavior?

Using reactive values for zIndex should not remove data curves from the plot entirely

Please provide a demo of the problem in a sandbox

https://stackblitz.com/edit/wzkj8wsc-otcdqw2a?file=src%2FExample.tsx

Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?

Haven't tested previous version., this is happening in 3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement to a current API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions