From ca96f8545f2fdea598db6334e082bff4dcf2ca9f Mon Sep 17 00:00:00 2001 From: Jae Sung Park Date: Fri, 8 Sep 2023 15:25:35 +0900 Subject: [PATCH] refactor(tooltip): Remove optional chainigs (#3411) Remove optional chaining as a possible prevention from the fix of #3407 Can be removed, as of conditional from event interaction will prevent it. --- src/ChartInternal/internals/tooltip.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ChartInternal/internals/tooltip.ts b/src/ChartInternal/internals/tooltip.ts index c8d168c30..4d7c8dc16 100644 --- a/src/ChartInternal/internals/tooltip.ts +++ b/src/ChartInternal/internals/tooltip.ts @@ -263,7 +263,7 @@ export default { const $$ = this; const {config, scale, state, $el: {eventRect, tooltip}} = $$; const {bindto} = config.tooltip_contents; - const datum = tooltip?.datum?.(); + const datum = tooltip?.datum(); if (!bindto && datum) { const [x, y] = getPointer(state.event, eventTarget ?? eventRect?.node()); // get mouse event position @@ -373,7 +373,7 @@ export default { return; } - let datum = tooltip?.datum?.(); + let datum = tooltip.datum(); const dataStr = JSON.stringify(selectedData); if (!datum || datum.current !== dataStr) { @@ -441,7 +441,7 @@ export default { const {api, config, $el: {tooltip}} = $$; if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) { - const selectedData = JSON.parse(tooltip?.datum?.().current ?? {}); + const selectedData = JSON.parse(tooltip.datum().current ?? {}); callFn(config.tooltip_onhide, api, selectedData);