File tree Expand file tree Collapse file tree
src/components/shared/chart Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -390,18 +390,12 @@ export class ChartCanvas<Item> extends React.Component<
390390 } ;
391391
392392 override UNSAFE_componentWillReceiveProps ( ) {
393- // It is possible that the data backing the chart has been
394- // changed, for instance after symbolication. Clear the
395- // hoveredItem if the mouse no longer hovers over it.
396- const { hoveredItem } = this . state ;
397- if (
398- hoveredItem !== null &&
399- ! hoveredItemsAreEqual (
400- this . props . hitTest ( this . _offsetX , this . _offsetY ) ,
401- hoveredItem
402- )
403- ) {
404- this . setState ( { hoveredItem : null } ) ;
393+ // Update the hovered item if the rendered data has changed or if
394+ // the chart has been scrolled so that a new element is under the
395+ // mouse cursor.
396+ const newHoveredItem = this . props . hitTest ( this . _offsetX , this . _offsetY ) ;
397+ if ( ! hoveredItemsAreEqual ( newHoveredItem , this . state . hoveredItem ) ) {
398+ this . setState ( { hoveredItem : newHoveredItem } ) ;
405399 }
406400 }
407401
You can’t perform that action at this time.
0 commit comments