mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-12 13:28:55 +00:00
fix(portfolio): actually refetch the property table after adding properties
invalidateQueries only refetches mounted queries; the property table isn't mounted on the add page, and useProperties' refetchOnMount: false then suppresses the refetch when it does mount — so the invalidation never produced a fetch. Removing the cached query instead guarantees the initial fetch on mount. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0b475d8e03
commit
2caac6fa6c
1 changed files with 5 additions and 3 deletions
|
|
@ -93,9 +93,11 @@ export default function AddPropertiesClient({
|
|||
setDone(totals);
|
||||
// Added properties change the search's alreadyInPortfolio flags
|
||||
queryClient.invalidateQueries(["postcode-search", portfolioId]);
|
||||
// …and the portfolio's property table, which otherwise stays stale for
|
||||
// 5 minutes (useProperties staleTime) on top of the router cache.
|
||||
queryClient.invalidateQueries(["properties", portfolioId]);
|
||||
// …and the portfolio's property table. Remove, don't invalidate: the
|
||||
// table isn't mounted here, and useProperties sets refetchOnMount:
|
||||
// false, so a stale-marked query would never actually refetch — only
|
||||
// an empty cache guarantees a fresh fetch when the table mounts.
|
||||
queryClient.removeQueries(["properties", portfolioId]);
|
||||
router.refresh();
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue