From e42d361c40ab626c01ae391442216402964103e5 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 17 Jul 2024 14:28:11 +0700 Subject: [PATCH] fix: preserve reactivity in props (#157) --- src/lib/syv.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib/syv.ts b/src/lib/syv.ts index 59bba46..0ba3db8 100644 --- a/src/lib/syv.ts +++ b/src/lib/syv.ts @@ -1,7 +1,6 @@ import type { ComponentProps, ComponentType, SvelteComponent } from 'svelte'; import type { Demand, LazyComponent, SyvOptions } from './types.js'; import { mount as create, unmount } from 'svelte'; -import { augment } from 'mauss/std'; let instance: ReturnType; @@ -13,13 +12,13 @@ export function mount( ) { instance && unmount(instance); // destroy here so it keeps the out transition - const options = Object.assign({ 'syv:intro': true }, demanded); - const props = Object.keys(options).filter((k) => !k.includes(':')); + const internal = Object.assign({ 'syv:intro': true }, demanded); + if (demanded) delete demanded['syv:intro'], delete demanded['syv:anchor']; // @ts-expect-error - not sure what's going on here instance = create(component, { - intro: options['syv:intro'], - target: options['syv:anchor'] || document.body, - props: augment(options).filter(props), + intro: internal['syv:intro'], + target: internal['syv:anchor'] || document.body, + props: demanded, // pass the object as-is to preserve reactivity }); }