From 2caac6fa6c6940c39df7df2fe8f165be0079cc89 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 7 Jul 2026 17:50:47 +0000 Subject: [PATCH] fix(portfolio): actually refetch the property table after adding properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../[slug]/properties/add/AddPropertiesClient.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/portfolio/[slug]/properties/add/AddPropertiesClient.tsx b/src/app/portfolio/[slug]/properties/add/AddPropertiesClient.tsx index 40b63237..81707862 100644 --- a/src/app/portfolio/[slug]/properties/add/AddPropertiesClient.tsx +++ b/src/app/portfolio/[slug]/properties/add/AddPropertiesClient.tsx @@ -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(); }, });