mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-13 16:16:46 +08:00
fix: doc update time outdated (#7344)
Fix issue [BS-603](https://linear.app/affine-design/issue/BS-603). - Move observe `blockUpdated` logic in `blocksuite-editor` component, so it can be excuted on both page-detail and center-peek mode. - Remove useless `getDocUpdatedAt` service, because blocksuite can get `docMeta` directly. https://github.com/toeverything/blocksuite/pull/7434 https://github.com/toeverything/AFFiNE/assets/12724894/e01e3f97-f1d0-4d1d-a8ed-e70e27e39bdb
This commit is contained in:
+11
@@ -88,6 +88,17 @@ const BlockSuiteEditorImpl = forwardRef<AffineEditorContainer, EditorProps>(
|
||||
[onLoadEditor, ref]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const disposable = page.slots.blockUpdated.once(() => {
|
||||
page.collection.setDocMeta(page.id, {
|
||||
updatedDate: Date.now(),
|
||||
});
|
||||
});
|
||||
return () => {
|
||||
disposable.dispose();
|
||||
};
|
||||
}, [page]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
editorDisposeRef.current();
|
||||
|
||||
@@ -75,13 +75,6 @@ const PageDetailEditorMain = memo(function PageDetailEditorMain({
|
||||
// debug current detail editor
|
||||
globalThis.currentEditor = editor;
|
||||
const disposableGroup = new DisposableGroup();
|
||||
disposableGroup.add(
|
||||
page.slots.blockUpdated.once(() => {
|
||||
page.collection.setDocMeta(page.id, {
|
||||
updatedDate: Date.now(),
|
||||
});
|
||||
})
|
||||
);
|
||||
localStorage.setItem('last_page_id', page.id);
|
||||
|
||||
if (onLoad) {
|
||||
|
||||
Reference in New Issue
Block a user