mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
refactor(editor): replace debounce and throttle with lodash (#10639)
This commit is contained in:
@@ -7,8 +7,8 @@ import {
|
||||
Slot,
|
||||
} from '@blocksuite/global/utils';
|
||||
import { computed, type Signal, signal } from '@preact/signals-core';
|
||||
import clonedeep from 'lodash.clonedeep';
|
||||
import mergeWith from 'lodash.mergewith';
|
||||
import clonedeep from 'lodash-es/cloneDeep';
|
||||
import mergeWith from 'lodash-es/mergeWith';
|
||||
import * as Y from 'yjs';
|
||||
import { z } from 'zod';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ReferenceInfo } from '@blocksuite/affine-model';
|
||||
import cloneDeep from 'lodash.clonedeep';
|
||||
import cloneDeep from 'lodash-es/cloneDeep';
|
||||
|
||||
/**
|
||||
* Clones reference info.
|
||||
|
||||
@@ -8,7 +8,8 @@ import {
|
||||
type GfxViewportElement,
|
||||
} from '@blocksuite/block-std/gfx';
|
||||
import type { Container, ServiceIdentifier } from '@blocksuite/global/di';
|
||||
import { debounce, DisposableGroup } from '@blocksuite/global/utils';
|
||||
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
|
||||
import {
|
||||
debugLog,
|
||||
@@ -144,13 +145,9 @@ export class ViewportTurboRendererExtension extends LifeCycleWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
debouncedRefresh = debounce(
|
||||
() => {
|
||||
this.refresh().catch(console.error);
|
||||
},
|
||||
debounceTime,
|
||||
{ leading: false, trailing: true }
|
||||
);
|
||||
debouncedRefresh = debounce(() => {
|
||||
this.refresh().catch(console.error);
|
||||
}, debounceTime);
|
||||
|
||||
invalidate() {
|
||||
this.layoutVersion++;
|
||||
|
||||
Reference in New Issue
Block a user