From 955da564a043434a9c59786d88964511e92e197c Mon Sep 17 00:00:00 2001 From: Benjamin Sutter Date: Thu, 21 May 2026 21:22:34 +0200 Subject: [PATCH] fix: invalidate properties cache after listing creation Without this, navigating to Meine Inserate within 5 min of visiting it previously would show a stale empty list. Co-Authored-By: Claude Sonnet 4.6 --- src/pages/supply/NewListing.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/supply/NewListing.tsx b/src/pages/supply/NewListing.tsx index 8508a92..e9c3b91 100644 --- a/src/pages/supply/NewListing.tsx +++ b/src/pages/supply/NewListing.tsx @@ -1,5 +1,6 @@ import { useState } from 'react' import { useLocation, useNavigate } from 'react-router' +import { useQueryClient } from '@tanstack/react-query' import { Alert, Box, @@ -76,6 +77,7 @@ interface LocationState { export default function NewListing() { const navigate = useNavigate() + const qc = useQueryClient() const { state } = useLocation() as { state: LocationState | null } const pre = state?.prefill ?? {} @@ -219,6 +221,7 @@ export default function NewListing() { try { await propertyService.create(input) + qc.invalidateQueries({ queryKey: ['properties'] }) setCreated(true) } catch { setError('Fehler beim Erstellen des Inserats. Bitte erneut versuchen.')