about summary refs log tree commit diff
path: root/src/components/Dialog/context.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-04-09 17:08:02 -0500
committerGitHub <noreply@github.com>2024-04-09 15:08:02 -0700
commitc96bc92042e2d5cb2a28736fd7a9dd2593a7b040 (patch)
treea3ee36404ff38f446459c3b77187c9ec183f267e /src/components/Dialog/context.ts
parenta49a5a351d2b58631d067c0524c5ebb097a3d5fe (diff)
downloadvoidsky-c96bc92042e2d5cb2a28736fd7a9dd2593a7b040.tar.zst
Small logic cleanups (#3449)
* Small logic cleanups

* Small logic cleanups (#3451)

* remove a few things

* oops

* stop swallowing the error

* queue callbacks

* oops

* log error if caught

* no need to be nullable

* move isClosing=true up

* reset `isClosing` and `closeCallbacks` on close completion and open

* run queued callbacks on `open` if there are any pending

* rm unnecessary ref and check

* ensure order of calls is always correct

* call `snapToIndex()` on open

* add tester to storybook

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/components/Dialog/context.ts')
-rw-r--r--src/components/Dialog/context.ts3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/components/Dialog/context.ts b/src/components/Dialog/context.ts
index df8bbb081..859f8edd7 100644
--- a/src/components/Dialog/context.ts
+++ b/src/components/Dialog/context.ts
@@ -39,8 +39,7 @@ export function useDialogControl(): DialogOuterProps['control'] {
         control.current.open()
       },
       close: cb => {
-        control.current.close()
-        cb?.()
+        control.current.close(cb)
       },
     }),
     [id, control],