Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Issue #5954 #6633

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thirty-rice-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@refinedev/antd": major
---

in queryoptions made the keepPreviousData as false so that user do not see the data of previous modal on opening the new one.
5 changes: 4 additions & 1 deletion packages/antd/src/hooks/form/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ export const useForm = <
onLiveEvent,
invalidates,
undoableTimeout,
queryOptions,
queryOptions: {
...queryOptions,
keepPreviousData: false,
},
createMutationOptions,
updateMutationOptions,
id: idFromProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ export const useModalForm = <
"Are you sure you want to leave? You have unsaved changes.",
),
);

if (warnWhenConfirm) {
setWarnWhen(false);
} else {
Expand All @@ -298,6 +297,7 @@ export const useModalForm = <
if (typeof showId !== "undefined") {
setId?.(showId);
}

const needsIdToOpen = action === "edit" || action === "clone";
const hasId = typeof showId !== "undefined" || typeof id !== "undefined";
if (needsIdToOpen ? hasId : true) {
Expand Down