From 93655b110caae8d1dde498eb2a79939f91aa6961 Mon Sep 17 00:00:00 2001 From: Ryan Atkinson Date: Sun, 9 Jun 2024 12:25:50 -0600 Subject: [PATCH] relax contextmenu action type to accept `null | undefined` (#26) --- .changeset/tender-jeans-fry.md | 5 +++++ src/lib/contextmenu_helpers.svelte.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/tender-jeans-fry.md diff --git a/.changeset/tender-jeans-fry.md b/.changeset/tender-jeans-fry.md new file mode 100644 index 000000000..cc91126ae --- /dev/null +++ b/.changeset/tender-jeans-fry.md @@ -0,0 +1,5 @@ +--- +'@ryanatkn/fuz': patch +--- + +relax `contextmenu_action` type to accept `null | undefined` diff --git a/src/lib/contextmenu_helpers.svelte.ts b/src/lib/contextmenu_helpers.svelte.ts index b7cdcb293..ef08fb649 100644 --- a/src/lib/contextmenu_helpers.svelte.ts +++ b/src/lib/contextmenu_helpers.svelte.ts @@ -274,8 +274,9 @@ let cache_key_counter = 0; export const contextmenu_action = ( el: HTMLElement | SVGElement, - params: U, -): ActionReturn => { + params: U | null | undefined, +): ActionReturn | undefined => { + if (params == null) return; const key = cache_key_counter++ + ''; el.dataset[CONTEXTMENU_DATASET_KEY] = key; contextmenu_cache.set(key, params);