From e36f2d995e55015cd3c2bbf5169745822b0737a4 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 3 Jul 2026 16:48:23 -0700 Subject: [PATCH] Fix stale data in tippy --- src/lib/components/Tippy.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/components/Tippy.svelte b/src/lib/components/Tippy.svelte index 82919022..a00934f9 100644 --- a/src/lib/components/Tippy.svelte +++ b/src/lib/components/Tippy.svelte @@ -17,6 +17,15 @@ let element: Element + // `mount` only tracks prop changes when the props come from a `$state` object, + // so sync incoming props into a reactive one. Without this the popover keeps + // the props it was first mounted with, showing stale data after the source updates. + const mountedProps = $state({...props}) + + $effect(() => { + Object.assign(mountedProps, props) + }) + onMount(() => { const target = document.createElement("div") @@ -28,7 +37,7 @@ ...params, }) - instance = mount(component, {target, props}) + instance = mount(component, {target, props: mountedProps}) return () => { popover?.destroy()