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:
dswbx
2025-09-23 13:47:10 +02:00
parent 49aee37199
commit ffe53d3fb5
2 changed files with 4 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ export const useEntityQuery = <
// mutate all keys of entity by default // mutate all keys of entity by default
if (options?.revalidateOnMutate !== false) { if (options?.revalidateOnMutate !== false) {
// don't use the id, to also update lists
await mutateFn(); await mutateFn();
} }
return res; return res;

View File

@@ -77,6 +77,9 @@ function DataEntityUpdateImpl({ params }) {
message: `Successfully updated ID ${entityId}`, message: `Successfully updated ID ${entityId}`,
color: "green", color: "green",
}); });
// make sure form picks up the latest data
Form.reset();
} catch (e) { } catch (e) {
setError(e instanceof Error ? e.message : "Failed to update"); setError(e instanceof Error ? e.message : "Failed to update");
} }