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(formula): init trigger calculation controller on rendered (#4118)
Dushusir9e7b9fb89072
diff --git a/packages-experimental/uni-formula-ui/src/uni-formula-ui.plugin.ts b/packages-experimental/uni-formula-ui/src/uni-formula-ui.plugin.tsindex 32f9bd618b..e0d86948ce 100644--- a/packages-experimental/uni-formula-ui/src/uni-formula-ui.plugin.ts+++ b/packages-experimental/uni-formula-ui/src/uni-formula-ui.plugin.ts@@ -16,7 +16,6 @@import type { Dependency } from '@univerjs/core';import { DependentOn, Inject, Injector, Plugin, touchDependencies, UniverInstanceType } from '@univerjs/core';-import { TriggerCalculationController } from '@univerjs/sheets-formula';import { IUniFormulaService, UniverDocUniFormulaPlugin } from '@univerjs/uni-formula';import { DOC_FORMULA_UI_PLUGIN_NAME } from './const';@@ -53,7 +52,6 @@ export class UniverDocUniFormulaUIPlugin extends Plugin {override onReady(): void {touchDependencies(this._injector, [[IUniFormulaService],- [TriggerCalculationController],]);}diff --git a/packages/sheets-formula/src/sheets-formula.plugin.ts b/packages/sheets-formula/src/sheets-formula.plugin.tsindex f6d2e7b52e..a13f46c5a2 100644--- a/packages/sheets-formula/src/sheets-formula.plugin.ts+++ b/packages/sheets-formula/src/sheets-formula.plugin.ts@@ -125,7 +125,7 @@ export class UniverSheetsFormulaPlugin extends Plugin {[UpdateDefinedNameController],]);- // The nodejs environment needs to be initialized, otherwise it has been initialized in FormulaUIController+ // There is no rendering in the nodejs environment, so initialize it hereif (isNodeEnv()) {touchDependencies(this._injector, [[TriggerCalculationController],@@ -137,5 +137,12 @@ export class UniverSheetsFormulaPlugin extends Plugin {touchDependencies(this._injector, [[DefinedNameController],]);++ // Wait for rendering to complete before initializing formula calculation+ if (!isNodeEnv()) {+ touchDependencies(this._injector, [+ [TriggerCalculationController],+ ]);+ }}}