mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
fix: ensure form updates with latest data after mutation
added a form reset to reflect up-to-date data changes and adjusted mutation to prevent id exclusion, ensuring lists are updated properly.
This commit is contained in:
@@ -156,6 +156,7 @@ export const useEntityQuery = <
|
||||
|
||||
// mutate all keys of entity by default
|
||||
if (options?.revalidateOnMutate !== false) {
|
||||
// don't use the id, to also update lists
|
||||
await mutateFn();
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -77,6 +77,9 @@ function DataEntityUpdateImpl({ params }) {
|
||||
message: `Successfully updated ID ${entityId}`,
|
||||
color: "green",
|
||||
});
|
||||
|
||||
// make sure form picks up the latest data
|
||||
Form.reset();
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : "Failed to update");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user