Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(docs): defer incompatible continuous publications (#7609)
Univerc2316bb00263
diff --git a/packages/engine-render/src/__tests__/worker-layout.spec.ts b/packages/engine-render/src/__tests__/worker-layout.spec.tsindex 01d8c913a1..afb6cbe01a 100644--- a/packages/engine-render/src/__tests__/worker-layout.spec.ts+++ b/packages/engine-render/src/__tests__/worker-layout.spec.ts@@ -1530,7 +1530,7 @@ describe('worker document layout session', () => {},});let probeResult = session.step(probeGeneration, 0);- let deferredVerticalBoundaryMismatch = false;+ let deferredBoundaryGeometryMismatch = false;for (let step = 0; step < 1_000 && !probeResult.progress.complete; step++) {const publication = probeResult.publication;if (publication?.kind === 'block') {@@ -1541,17 +1541,19 @@ describe('worker document layout session', () => {const workerBoundaryLine = transferredPublication.block.flow.lines[firstUnprotectedLineIndex - 1];if (workerBoundaryLine != null) {workerBoundaryLine.top += 1;+ workerBoundaryLine.lineHeight += 1;+ workerBoundaryLine.width = (workerBoundaryLine.width ?? 0) + 1;expect(() => targetSkeleton.applyLayoutPublication(transferredPublication,probeResult.progress)).not.toThrow();- deferredVerticalBoundaryMismatch = true;+ deferredBoundaryGeometryMismatch = true;break;}}probeResult = session.step(probeGeneration, 0);}- expect(deferredVerticalBoundaryMismatch).toBe(true);+ expect(deferredBoundaryGeometryMismatch).toBe(true);expect(targetSkeleton.getSkeletonData()?.pages[0]).toBe(protectedContinuousPage);targetSkeleton.cancelExternalLayout();diff --git a/packages/engine-render/src/components/docs/layout/doc-skeleton.ts b/packages/engine-render/src/components/docs/layout/doc-skeleton.tsindex 8e6f4ea6e9..3804e5486c 100644--- a/packages/engine-render/src/components/docs/layout/doc-skeleton.ts+++ b/packages/engine-render/src/components/docs/layout/doc-skeleton.ts@@ -2565,17 +2565,19 @@ export class DocumentSkeleton extends Skeleton {if (mainBoundaryLine == null ||mainBoundaryLine.st !== workerBoundaryLine.st ||- mainBoundaryLine.ed !== workerBoundaryLine.ed ||- mainBoundaryLine.lineHeight !== workerBoundaryLine.lineHeight ||- mainBoundaryLine.width !== workerBoundaryLine.width+ mainBoundaryLine.ed !== workerBoundaryLine.ed) {throw new Error(`Continuous layout Main and Worker boundaries do not share the same continuation checkpoint: Main ${mainBoundaryLine?.st}:${mainBoundaryLine?.ed}@${mainBoundaryLine?.top}/${mainBoundaryLine?.lineHeight}/${mainBoundaryLine?.width}, Worker ${workerBoundaryLine.st}:${workerBoundaryLine.ed}@${workerBoundaryLine.top}/${workerBoundaryLine.lineHeight}/${workerBoundaryLine.width}.`);}- if (mainBoundaryLine.top !== workerBoundaryLine.top) {- // A Custom Block can finish measuring after Main publishes the- // interaction window but before Worker captures its viewport.- // The continuation identity still matches, while every absolute- // coordinate after it belongs to a different vertical geometry.+ if (+ mainBoundaryLine.top !== workerBoundaryLine.top ||+ mainBoundaryLine.lineHeight !== workerBoundaryLine.lineHeight ||+ mainBoundaryLine.width !== workerBoundaryLine.width+ ) {+ // A Custom Block, font, or host viewport can finish measuring+ // after Main publishes the interaction window but before Worker+ // captures its geometry. The continuation identity still matches,+ // while every coordinate after it belongs to a different layout.// Keep Main visible and commit the canonical Worker result only// after completion instead of translating a partial collection of// lines, tables, drawings, and column groups independently.