about summary refs log tree commit diff
path: root/src/components/Dialog/context.ts
diff options
context:
space:
mode:
authorJan-Olof Eriksson <jan-olof.eriksson@iki.fi>2024-03-11 14:52:33 +0200
committerGitHub <noreply@github.com>2024-03-11 14:52:33 +0200
commit4a2251f48bd51d8bd427d21f0dd697c8d43d7856 (patch)
tree17b7d68f0a19f54313607257de79accc7b6daf4c /src/components/Dialog/context.ts
parentcbc65247ae57502356165a5d51270bd8d19fd9a5 (diff)
parent596e744d4177d3be6defeef68f202a70baaf6e37 (diff)
downloadvoidsky-4a2251f48bd51d8bd427d21f0dd697c8d43d7856.tar.zst
Merge branch 'bluesky-social:main' into main
Diffstat (limited to 'src/components/Dialog/context.ts')
-rw-r--r--src/components/Dialog/context.ts23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/components/Dialog/context.ts b/src/components/Dialog/context.ts
index eb717d8e2..859f8edd7 100644
--- a/src/components/Dialog/context.ts
+++ b/src/components/Dialog/context.ts
@@ -31,14 +31,17 @@ export function useDialogControl(): DialogOuterProps['control'] {
     }
   }, [id, activeDialogs])
 
-  return {
-    id,
-    ref: control,
-    open: () => {
-      control.current.open()
-    },
-    close: cb => {
-      control.current.close(cb)
-    },
-  }
+  return React.useMemo<DialogOuterProps['control']>(
+    () => ({
+      id,
+      ref: control,
+      open: () => {
+        control.current.open()
+      },
+      close: cb => {
+        control.current.close(cb)
+      },
+    }),
+    [id, control],
+  )
 }