Skip to content

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.

fix: get SheetScrollManagerService from renderManagerSrv (#2833)

lumixce4e7c40ac88
diff --git a/packages/sheets-ui/src/commands/commands/set-frozen.command.ts b/packages/sheets-ui/src/commands/commands/set-frozen.command.ts
index 2558061f3f..8f802aa18c 100644
--- a/packages/sheets-ui/src/commands/commands/set-frozen.command.ts
+++ b/packages/sheets-ui/src/commands/commands/set-frozen.command.ts
@@ -19,6 +19,7 @@ import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService,
import type { ISetFrozenMutationParams } from '@univerjs/sheets';
import { getSheetCommandTarget, SetFrozenMutation, SetFrozenMutationFactory, SheetsSelectionsService } from '@univerjs/sheets';
+import { IRenderManagerService } from '@univerjs/engine-render';
import { SheetScrollManagerService } from '../../services/scroll-manager.service';
export enum SetSelectionFrozenType {
@@ -50,7 +51,10 @@ export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParam
}
const currentSelection = selections[selections?.length - 1];
const { range } = currentSelection;
- const scrollManagerService = accessor.get(SheetScrollManagerService);
+
+ const renderManagerSrv = accessor.get(IRenderManagerService);
+ const scrollManagerService = renderManagerSrv.getRenderById(unitId)!.with(SheetScrollManagerService);
+
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = scrollManagerService.getCurrentScrollState() || {};
let startRow;
let startColumn;