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();