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) <noreply@anthropic.com>
This commit is contained in:
@@ -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'] });
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user