Skip to content

Commit

Permalink
fix(ui): Dashboard and Details reflect correct data (#997)
Browse files Browse the repository at this point in the history
* Test: Force refetch after navigation

* Reload before navigating to ensure correct data

* Add comment for clarity

* Clean up redundant line
  • Loading branch information
charmcitygavin authored Jan 10, 2025
1 parent d2df3ee commit a6f4168
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions react-app/src/components/ActionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ export const ActionForm = <Schema extends SchemaWithEnforcableProps>({
API.post("os", "/submit", {
body: formData,
}),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["record"] });
},
});

const onSubmit = form.handleSubmit(async (formData) => {
Expand Down Expand Up @@ -174,6 +171,8 @@ export const ActionForm = <Schema extends SchemaWithEnforcableProps>({
pathnameToDisplayOn: formOrigins.pathname,
});

// Prevent stale data from displaying on formOrigins page
await queryClient.invalidateQueries({ queryKey: ["record"] });
navigate(formOrigins);
} catch (error) {
console.error(error);
Expand Down

0 comments on commit a6f4168

Please sign in to comment.