From 696865eceb8fdbe6c71e1c7042a0509c7a758b26 Mon Sep 17 00:00:00 2001 From: Ugo Stephant Date: Fri, 21 Jul 2023 08:38:46 +0200 Subject: [PATCH] fix: update tooltip on marker position change --- packages/react-d3-plugin/lib/Marker/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/react-d3-plugin/lib/Marker/index.js b/packages/react-d3-plugin/lib/Marker/index.js index ffc4f89eb..f44c083a8 100644 --- a/packages/react-d3-plugin/lib/Marker/index.js +++ b/packages/react-d3-plugin/lib/Marker/index.js @@ -1,4 +1,10 @@ -import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react'; +import { + forwardRef, + useEffect, + useImperativeHandle, + useMemo, + useRef, +} from 'react'; import { Tooltip, classNames } from '@junipero/react'; import PropTypes from 'prop-types'; @@ -60,6 +66,10 @@ const Marker = forwardRef(({ isJunipero: true, })); + useEffect(() => { + tooltipRef.current?.update?.(); + }, [x]); + if (!cursor) { return null; }