From 400ff993d2e0ba58e060d04384d10030453bbd79 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 25 May 2026 18:09:17 +0200 Subject: [PATCH] fix(berths): inline edits on detail Overview tab now persist visually useBerthPatch invalidated ['berths', berthId] (plural+id), but the berth detail page reads ['berth', berthId] (singular+id). Cache key never matched, so the PATCH landed in the DB but the visible field reverted to its pre-edit value on re-render. Realtime invalidation covered for it via 'berth:updated', but Socket.IO is unavailable in some dev environments. Switch to the correct singular key + keep the plural-list invalidation so list views (BerthList, bulk-edit sheet) also refresh. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/berths/berth-tabs.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/berths/berth-tabs.tsx b/src/components/berths/berth-tabs.tsx index d8150c20..97590147 100644 --- a/src/components/berths/berth-tabs.tsx +++ b/src/components/berths/berth-tabs.tsx @@ -117,7 +117,11 @@ function useBerthPatch(berthId: string) { body: patch, }), onSuccess: () => { - qc.invalidateQueries({ queryKey: ['berths', berthId] }); + // Detail page query is keyed `['berth', berthId]` (singular); the + // list query is `['berths']` (plural). Invalidate both so inline + // edits on the detail Overview tab refresh the visible value + // even when Socket.IO realtime isn't running (dev / no-ws envs). + qc.invalidateQueries({ queryKey: ['berth', berthId] }); qc.invalidateQueries({ queryKey: ['berths'] }); }, });