From 439e10d7b15819bd06864e626daad94f241a4567 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 9 Jul 2022 20:46:42 -0500 Subject: [PATCH] Create tooltips' pinnable persistent variable immediately --- src/features/tooltips/tooltip.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/features/tooltips/tooltip.ts b/src/features/tooltips/tooltip.ts index 19ab705..dcc618f 100644 --- a/src/features/tooltips/tooltip.ts +++ b/src/features/tooltips/tooltip.ts @@ -70,19 +70,19 @@ export function addTooltip( processComputable(options as T, "xoffset"); processComputable(options as T, "yoffset"); - nextTick(() => { - if (options.pinnable) { - if ("pinned" in element) { - console.error( - "Cannot add pinnable tooltip to element that already has a property called 'pinned'" - ); - options.pinnable = false; - } else { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (element as any).pinned = options.pinned = persistent(false); - } + if (options.pinnable) { + if ("pinned" in element) { + console.error( + "Cannot add pinnable tooltip to element that already has a property called 'pinned'" + ); + options.pinnable = false; + } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (element as any).pinned = options.pinned = persistent(false); } + } + nextTick(() => { const elementComponent = element[Component]; element[Component] = TooltipComponent; const elementGatherProps = element[GatherProps].bind(element);