question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tooltip disappears after Component.setState()

See original GitHub issue

With gratitude to the maintainers and contributors to this fine library! If this is an error in my code, do let me know! I took a look at the source code to see if I could make this a PR instead of an issue, but couldn’t determine the cause of this issue.

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

As soon as Component.setState() is called by another component (not the recharts graph), the tooltip disappears.

Reproduction steps

Bug is present in this deployed app.

Before adding the following code in the code for <Sidebar />, tooltip was working perfectly. Sidebar is a component unrelated to the recharts graph.

  updateSidebar = event => {
    if (event && event.activeTooltipIndex) {
      const activePoint = this.state.graph.data[0].points[
        event.activeTooltipIndex
      ]

      this.setState(prevState => ({
        ...prevState,
        graph: Object.assign({}, this.state.graph, { activePoint })
      }))
    }
  }

Changing the contents of the setState function doesn’t make a difference, as long as setState() gets called, <Tooltip />'s props get set to active: false and the tooltip disappears.

May be related to #1179, though I don’t see the chart redraw animation happening each time setState is called.

I can recreate in a JSFiddle if someone has a working template (current templates are broken)

What is the expected behavior?

Tooltip can persist even as state is updated.

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

Chrome 64.0.3282.186 Mac OS 10.12.6 Recharts 1.0.0-beta.10

Thanks for any insights!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
andyngdzcommented, Aug 7, 2019
0reactions
simonhessnercommented, May 25, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Material UI Tooltip Stays Open after triggered Dialog is closed
The Dialog pops up as it should but when the dialog is exited, the Tooltip pops up as active. class DeleteDocument extends React.Component...
Read more >
Controlling tooltips & pop-up menus with components in React
Use compound components to control tooltips and pop-up menus in your React ... Your tooltip should appear on top of all the other...
Read more >
Show and Hide the Tooltip - DevExtreme - DevExpress
After that, change this component property, and the Tooltip will appear or disappear. Angular. HTML. TypeScript.
Read more >
Error tooltip disappears immediately when hovering cursor
Error tooltip disappears immediately when hovering cursor · 1. You have a Flow error · 2. hover over the error · 3. try...
Read more >
React.js Blueprint Tooltip2 Combining with popover
transitionDuration: This prop denotes how long the tooltip component appears/disappears transition takes in milliseconds. Syntax:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found