diff options
Diffstat (limited to 'src/components/Dialog/context.ts')
-rw-r--r-- | src/components/Dialog/context.ts | 23 |
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], + ) } |