1414 * limitations under the License.
1515 */
1616
17- import type { ICommandInfo , IRange , Nullable , Workbook , Worksheet } from '@univerjs/core' ;
17+ import type { ICommandInfo , IExecutionOptions , IRange , Nullable , Workbook , Worksheet } from '@univerjs/core' ;
1818import type { ISetFormulaCalculationNotificationMutation } from '@univerjs/engine-formula' ;
1919import type { IAfterRender$Info , IBasicFrameInfo , IExtendFrameInfo , IRenderContext , IRenderModule , IScrollBarProps , ISummaryFrameInfo , ISummaryMetric , ITimeMetric , IViewportInfos , Scene } from '@univerjs/engine-render' ;
2020import type { IUniverSheetsUIConfig } from '../config.schema' ;
@@ -403,7 +403,7 @@ export class SheetRenderController extends RxDisposable implements IRenderModule
403403 }
404404
405405 private _initCommandListener ( ) : void {
406- this . disposeWithMe ( this . _commandService . onCommandExecuted ( ( command : ICommandInfo ) => {
406+ this . disposeWithMe ( this . _commandService . onCommandExecuted ( ( command : ICommandInfo , options ) => {
407407 const { unit : workbook } = this . _context ;
408408 const { id : commandId } = command ;
409409
@@ -443,12 +443,12 @@ export class SheetRenderController extends RxDisposable implements IRenderModule
443443
444444 // All mutations must be executed. Using reCalculate alone will not trigger a refresh.
445445 if ( command . type === CommandType . MUTATION ) {
446- this . _markUnitDirty ( command ) ;
446+ this . _markUnitDirty ( command , options ) ;
447447 }
448448 } ) ) ;
449449 }
450450
451- private _markUnitDirty ( command : ICommandInfo ) {
451+ private _markUnitDirty ( command : ICommandInfo , options : IExecutionOptions | undefined ) {
452452 if ( command . id . substring ( 0 , 3 ) === 'doc' ) {
453453 return ;
454454 }
@@ -471,20 +471,20 @@ export class SheetRenderController extends RxDisposable implements IRenderModule
471471
472472 const cmdParams = command . params as Record < string , any > ;
473473 const viewports = this . _spreadsheetViewports ( scene ) ;
474- if ( command . id === SetRangeValuesMutation . id && cmdParams . cellValue ) {
474+ if ( command . id === SetRangeValuesMutation . id && cmdParams . cellValue && ! options ?. fromChangeset ) {
475475 const dirtyRange : IRange = this . _cellValueToRange ( cmdParams . cellValue ) ;
476476 const dirtyBounds = this . _rangeToBounds ( [ dirtyRange ] ) ;
477477 this . _markViewportDirty ( viewports , dirtyBounds ) ;
478- ( spreadsheet as unknown as Spreadsheet ) . setDirtyArea ( dirtyBounds ) ;
478+ ( spreadsheet as Spreadsheet ) . setDirtyArea ( dirtyBounds ) ;
479479 }
480480
481- if ( command . id === MoveRangeMutation . id && cmdParams . from && cmdParams . to ) {
481+ if ( command . id === MoveRangeMutation . id && cmdParams . from && cmdParams . to && ! options ?. fromChangeset ) {
482482 // keep the get _cellValueToRange code to ensure the code can effect as before
483483 const fromRange = cmdParams . fromRange || this . _cellValueToRange ( cmdParams . from . value ) ;
484484 const toRange = cmdParams . toRange || this . _cellValueToRange ( cmdParams . to . value ) ;
485485 const dirtyBounds = this . _rangeToBounds ( [ fromRange , toRange ] ) ;
486486 this . _markViewportDirty ( viewports , dirtyBounds ) ;
487- ( spreadsheet as unknown as Spreadsheet ) . setDirtyArea ( dirtyBounds ) ;
487+ ( spreadsheet as Spreadsheet ) . setDirtyArea ( dirtyBounds ) ;
488488 }
489489 }
490490
0 commit comments