mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
fix(useOverlay): set props to original props when defaultOpen is set (#4308)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -46,7 +46,7 @@ function _useOverlay() {
|
|||||||
isMounted: !!defaultOpen,
|
isMounted: !!defaultOpen,
|
||||||
destroyOnClose: !!destroyOnClose,
|
destroyOnClose: !!destroyOnClose,
|
||||||
originalProps: props || {},
|
originalProps: props || {},
|
||||||
props: {}
|
props: { ...(props || {}) }
|
||||||
})
|
})
|
||||||
|
|
||||||
overlays.push(options)
|
overlays.push(options)
|
||||||
@@ -110,9 +110,7 @@ function _useOverlay() {
|
|||||||
const patch = <T extends Component>(id: symbol, props: Partial<ComponentProps<T>>): void => {
|
const patch = <T extends Component>(id: symbol, props: Partial<ComponentProps<T>>): void => {
|
||||||
const overlay = getOverlay(id)
|
const overlay = getOverlay(id)
|
||||||
|
|
||||||
Object.entries(props!).forEach(([key, value]) => {
|
overlay.props = { ...props }
|
||||||
(overlay.props as any)[key] = value
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getOverlay = (id: symbol): Overlay => {
|
const getOverlay = (id: symbol): Overlay => {
|
||||||
|
|||||||
Reference in New Issue
Block a user