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(rpc): fix reading value from undefined

Wenzhao Hud0cf6f37077d
diff --git a/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts b/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts
index 6105d14cc1..33c695c2ac 100644
--- a/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts
+++ b/packages/rpc/src/controllers/data-sync/data-sync-primary.controller.ts
@@ -96,7 +96,7 @@ export class DataSyncPrimaryController extends RxDisposable {
// Mutations executed on the main thread should be synced to the worker thread.
this._commandService.onCommandExecuted((commandInfo, options) => {
const { type, params } = commandInfo;
- const unitID = (params as any).unitId || ''; // TODO@wzhudev: use a universal way to get unitId
+ const unitID = (params as any)?.unitId || ''; // TODO@wzhudev: use a universal way to get unitId
if (
// only sync mutations to the worker thread
type === CommandType.MUTATION &&