Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(formula): init trigger calculation controller on rendered #4118

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -53,7 +52,6 @@ export class UniverDocUniFormulaUIPlugin extends Plugin {
override onReady(): void {
touchDependencies(this._injector, [
[IUniFormulaService],
[TriggerCalculationController],
]);
}

Expand Down
9 changes: 8 additions & 1 deletion packages/sheets-formula/src/sheets-formula.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 here
if (isNodeEnv()) {
touchDependencies(this._injector, [
[TriggerCalculationController],
Expand All @@ -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],
]);
}
}
}
Loading