mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 11:41:56 +03:00
Fix infinite callstack while opening a popover (#10391)
This commit is contained in:
parent
19d5bdb9da
commit
201eec3b84
@ -80,18 +80,22 @@ export function DialogStackRegistrar(props: React.PropsWithChildren<DialogStackI
|
||||
const idRef = React.useRef(idRaw)
|
||||
const typeRef = React.useRef(typeRaw)
|
||||
|
||||
const ctx = React.useContext(DialogStackContext)
|
||||
const context = React.useContext(DialogStackContext)
|
||||
|
||||
invariant(ctx, 'DialogStackRegistrar must be used within a DialogStackProvider')
|
||||
invariant(context, 'DialogStackRegistrar must be used within a DialogStackProvider')
|
||||
|
||||
const { add, slice } = context
|
||||
|
||||
React.useEffect(() => {
|
||||
const id = idRef.current
|
||||
const type = typeRef.current
|
||||
ctx.add({ id, type })
|
||||
|
||||
add({ id, type })
|
||||
|
||||
return () => {
|
||||
ctx.slice(id)
|
||||
slice(id)
|
||||
}
|
||||
}, [ctx])
|
||||
}, [add, slice])
|
||||
|
||||
return children
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user