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 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-05-21 21:22:34 +02:00
parent c9324e9cc8
commit 955da564a0
+3
View File
@@ -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.')