fix(base): invalidate row cache on base:schema:bumped

This commit is contained in:
Philipinho
2026-05-24 02:43:16 +01:00
parent 651f799e3a
commit b83b92bea6
@@ -94,6 +94,12 @@ type BaseFormulaRecomputeCompleted = {
errored: number; errored: number;
}; };
type BaseSchemaBumped = {
operation: "base:schema:bumped";
pageId: string;
schemaVersion: number;
};
type BaseInboundEvent = type BaseInboundEvent =
| BaseRowCreated | BaseRowCreated
| BaseRowUpdated | BaseRowUpdated
@@ -103,6 +109,7 @@ type BaseInboundEvent =
| BaseRowsUpdated | BaseRowsUpdated
| BaseFormulaRecomputeStarted | BaseFormulaRecomputeStarted
| BaseFormulaRecomputeCompleted | BaseFormulaRecomputeCompleted
| BaseSchemaBumped
| BasePropertyEvent | BasePropertyEvent
| BaseViewEvent | BaseViewEvent
| { operation: string; pageId: string }; | { operation: string; pageId: string };
@@ -298,6 +305,14 @@ export function useBaseSocket(pageId: string | undefined): void {
} }
break; 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": { case "base:formula:recompute:started": {
const e = event as BaseFormulaRecomputeStarted; const e = event as BaseFormulaRecomputeStarted;
const store = getDefaultStore(); const store = getDefaultStore();