When Tooltip is used with a child chart, and it receives new props, the child chart never updates
See original GitHub issueExpected Behavior
The child chart should update when props are swapped
Current Behavior
The child chart does not update
Possible Solution
Steps to Reproduce (for bugs)
- Create a chart with the Tooltip parent and a child chart (ex. StackedArea), with a valid data prop
- Pass a new valid data prop to the child chart
- Notice that child chart does not re-render with new data
Context
The reason this happens is because we are rendering the child chart in Tooltip’s constructor
function, which only gets run on instantiation.
Even passing new props directly to the child chart does not seem to help.
We probably need to refactor the way the Tooltip interacts with its child chart.
Your Environment
- Version used:
- Browser Name and version:
- Operating System and version:
- Link to your project or codepen:
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
React: why child component doesn't update when prop changes
Depends on what you are trying to achieve. Parent can't poke around child props to change it. parent needs to re-render itself to...
Read more >visx/tooltip documentation
This package provides two ways to add tooltip state logic to your chart ... To use a Portal , simply pass your Tooltip...
Read more >Tooltip - Examples - Components - Atlassian Design System
A tooltip is a floating, non-actionable label used to explain a user interface element or feature.
Read more >jasongaare/react-native-walkthrough-tooltip - GitHub
Changes to handling users pressing the tooltip child element: No more onChildPress and onChildLongPress props - touches are now passed to the child...
Read more >Controlling tooltips & pop-up menus with components in React
Children with map function to iterate over all the children and return a clone of each child with React.cloneElement . Also, use of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DalerAsrorov no problem, thanks for the quick response. Will take a look at this and submit a PR.
Thanks!