Skip to content

Commit a598267

Browse files
authored
feat(Dialog): add useDialogContainer hook (#612)
1 parent 4051fe9 commit a598267

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/great-shoes-speak.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cube-dev/ui-kit': patch
3+
---
4+
5+
Postpone form reset in DialogForm until closing transition is over.

src/components/overlays/Dialog/DialogForm.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ export function DialogForm<T extends FieldTypes = FieldTypes>(
8585
onDismiss?.();
8686

8787
if (!preserve) {
88-
form?.resetFields();
88+
// let animations finish before resetting the form
89+
setTimeout(() => {
90+
form?.resetFields();
91+
}, 250);
8992
}
9093
}
9194

@@ -120,7 +123,10 @@ export function DialogForm<T extends FieldTypes = FieldTypes>(
120123
onClose?.();
121124

122125
if (!preserve) {
123-
form?.resetFields();
126+
// let animations finish before resetting the form
127+
setTimeout(() => {
128+
form.resetFields();
129+
}, 250);
124130
}
125131
}}
126132
onSubmitFailed={onSubmitFailed}

0 commit comments

Comments
 (0)