From b83b92bea6f08eca1478f72ecd3af218d784ec12 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 24 May 2026 02:43:16 +0100 Subject: [PATCH] fix(base): invalidate row cache on base:schema:bumped --- .../src/features/base/hooks/use-base-socket.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/client/src/features/base/hooks/use-base-socket.ts b/apps/client/src/features/base/hooks/use-base-socket.ts index 41174e017..02a784aa6 100644 --- a/apps/client/src/features/base/hooks/use-base-socket.ts +++ b/apps/client/src/features/base/hooks/use-base-socket.ts @@ -94,6 +94,12 @@ type BaseFormulaRecomputeCompleted = { errored: number; }; +type BaseSchemaBumped = { + operation: "base:schema:bumped"; + pageId: string; + schemaVersion: number; +}; + type BaseInboundEvent = | BaseRowCreated | BaseRowUpdated @@ -103,6 +109,7 @@ type BaseInboundEvent = | BaseRowsUpdated | BaseFormulaRecomputeStarted | BaseFormulaRecomputeCompleted + | BaseSchemaBumped | BasePropertyEvent | BaseViewEvent | { operation: string; pageId: string }; @@ -298,6 +305,14 @@ export function useBaseSocket(pageId: string | undefined): void { } break; } + case "base:schema:bumped": { + // The worker just committed a property type conversion (Path 3) or + // a property/cell GC. Invalidate the base + row caches so cells + // re-fetch under the new schema. + queryClient.invalidateQueries({ queryKey: ["base-rows", pageId] }); + queryClient.invalidateQueries({ queryKey: ["bases", pageId] }); + break; + } case "base:formula:recompute:started": { const e = event as BaseFormulaRecomputeStarted; const store = getDefaultStore();