TooltipPlugin: Fix console error when data updates while anchored (#88546)

This commit is contained in:
Leon Sorokin 2024-05-31 13:17:54 -05:00 committed by GitHub
parent 36f42853dd
commit a257b74d6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -404,6 +404,7 @@ export const TooltipPlugin2 = ({
config.addHook('setData', (u) => {
yZoomed = false;
yDrag = false;
dismiss();
});
// fires on series focus/proximity changes
@ -526,6 +527,10 @@ export const TooltipPlugin2 = ({
return () => {
window.removeEventListener('resize', updateWinSize);
window.removeEventListener('scroll', onscroll, true);
// in case this component unmounts while anchored (due to data auto-refresh + re-config)
document.removeEventListener('mousedown', downEventOutside, true);
document.removeEventListener('keydown', downEventOutside, true);
};
}, [config]);