Skip to content

Commit

Permalink
relax contextmenu action type to accept null | undefined (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn authored Jun 9, 2024
1 parent f44a670 commit 93655b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tender-jeans-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ryanatkn/fuz': patch
---

relax `contextmenu_action` type to accept `null | undefined`
5 changes: 3 additions & 2 deletions src/lib/contextmenu_helpers.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ let cache_key_counter = 0;

export const contextmenu_action = <T extends Contextmenu_Params, U extends T | T[]>(
el: HTMLElement | SVGElement,
params: U,
): ActionReturn<U> => {
params: U | null | undefined,
): ActionReturn<U> | undefined => {
if (params == null) return;
const key = cache_key_counter++ + '';
el.dataset[CONTEXTMENU_DATASET_KEY] = key;
contextmenu_cache.set(key, params);
Expand Down

0 comments on commit 93655b1

Please sign in to comment.