fix: exception with dialogs

Massimo Melina committed Mar 22, 2023 at 23:41 UTC a3f2188c05ef29c91a3c29da3c8cf3c89eec431e
1 file changed +2 -1
admin/src/dialog.ts
+2 -1
@@ -42,6 +42,7 @@ dialogsDefaults.Container = function Container(d:DialogOptions) {
42 })
43 return () => clearTimeout(h)
44 }, [ref.current])
45 + const titleSx = useDialogBarColors() // don't move this hook inside the return. When closing+showing at once it throws about rendering with fewer hooks.
46 d = { ...dialogsDefaults, ...d }
47 const { sx, root, ...rest } = d.dialogProps||{}
48 dialogsDefaults.dialogProps = { fullScreen: mobile, sx: { overflow:'initial' } }
@@ -57,7 +58,7 @@ dialogsDefaults.Container = function Container(d:DialogOptions) {
58 sx: {
59 position: 'sticky', top: 0, py: 1, pr: 1, zIndex: 2, boxShadow: '0 0 8px #0004',
60 display: 'flex', alignItems: 'center',
60 - ...useDialogBarColors()
61 + ...titleSx
62 }
63 },
64 h(Box, { flex:1, minWidth: 40 }, componentOrNode(d.title)),