mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
Merge pull request #286 from toeverything/fix/remove-async-block-cache
fix: remove asyncBlock cache
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable max-lines */
|
||||
import HotKeys from 'hotkeys-js';
|
||||
import LRUCache from 'lru-cache';
|
||||
|
||||
import type { PatchNode } from '@toeverything/components/ui';
|
||||
import type {
|
||||
@@ -46,10 +45,7 @@ export interface EditorCtorProps {
|
||||
}
|
||||
|
||||
export class Editor implements Virgo {
|
||||
private _cacheManager = new LRUCache<string, Promise<AsyncBlock | null>>({
|
||||
max: 8192,
|
||||
ttl: 1000 * 60 * 30,
|
||||
});
|
||||
private _cacheManager = new Map<string, Promise<AsyncBlock | null>>();
|
||||
public mouseManager = new MouseManager(this);
|
||||
public selectionManager = new SelectionManager(this);
|
||||
public keyboardManager = new KeyboardManager(this);
|
||||
@@ -234,7 +230,12 @@ export class Editor implements Virgo {
|
||||
return await services.api.editorBlock.update(patches);
|
||||
},
|
||||
remove: async ({ workspace, id }: WorkspaceAndBlockId) => {
|
||||
return await services.api.editorBlock.delete({ workspace, id });
|
||||
const ret = await services.api.editorBlock.delete({
|
||||
workspace,
|
||||
id,
|
||||
});
|
||||
this._cacheManager.delete(id);
|
||||
return ret;
|
||||
},
|
||||
observe: async (
|
||||
{ workspace, id }: WorkspaceAndBlockId,
|
||||
|
||||
Reference in New Issue
Block a user