Skip to content

Commit

Permalink
fix(sheets-hyper-link): re-render perf issue (#2812)
Browse files Browse the repository at this point in the history
  • Loading branch information
weird94 authored Jul 18, 2024
1 parent 3a4de22 commit 706aa04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import type { IRenderContext, IRenderModule, Spreadsheet } from '@univerjs/engine-render';
import { IRenderManagerService } from '@univerjs/engine-render';
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
import { debounceTime } from 'rxjs';

export class SheetsHyperLinkRenderController extends Disposable implements IRenderModule {
constructor(
Expand Down Expand Up @@ -55,7 +56,7 @@ export class SheetsHyperLinkRenderController extends Disposable implements IRend
}
};

this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(() => {
this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(debounceTime(16)).subscribe(() => {
markSkeletonDirty();
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import type { Spreadsheet } from '@univerjs/engine-render';
import { IRenderManagerService } from '@univerjs/engine-render';
import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment-base';
import { debounceTime } from 'rxjs';

@OnLifecycle(LifecycleStages.Ready, SheetsThreadCommentRenderController)
export class SheetsThreadCommentRenderController extends Disposable {
Expand Down Expand Up @@ -88,7 +89,7 @@ export class SheetsThreadCommentRenderController extends Disposable {
}
};

this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe((update) => {
this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(debounceTime(16)).subscribe((update) => {
markSkeletonDirty();
}));
}
Expand Down

0 comments on commit 706aa04

Please sign in to comment.