mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
chore: bump blocksuite (#7235)
## Features - https://github.com/toeverything/BlockSuite/pull/7340 @pengx17 - https://github.com/toeverything/BlockSuite/pull/7334 @EYHN - https://github.com/toeverything/BlockSuite/pull/7339 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7328 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7324 @Flrande - https://github.com/toeverything/BlockSuite/pull/7297 @pengx17 - https://github.com/toeverything/BlockSuite/pull/7318 @CatsJuice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/7343 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7345 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7341 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7342 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7329 @CatsJuice - https://github.com/toeverything/BlockSuite/pull/7337 @fundon - https://github.com/toeverything/BlockSuite/pull/7333 @fundon - https://github.com/toeverything/BlockSuite/pull/7326 @akumatus - https://github.com/toeverything/BlockSuite/pull/7325 @Flrande - https://github.com/toeverything/BlockSuite/pull/7323 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7312 @golok727 - https://github.com/toeverything/BlockSuite/pull/7317 @CatsJuice - https://github.com/toeverything/BlockSuite/pull/7319 @akumatus ## Refactor - https://github.com/toeverything/BlockSuite/pull/7327 @Flrande - https://github.com/toeverything/BlockSuite/pull/7320 @Flrande ## Misc - https://github.com/toeverything/BlockSuite/pull/7303 @fundon - https://github.com/toeverything/BlockSuite/pull/7321 @Saul-Mirone
This commit is contained in:
@@ -9,12 +9,12 @@ export function useAllBlockSuiteDocMeta(
|
||||
docCollection: DocCollection
|
||||
): DocMeta[] {
|
||||
if (!weakMap.has(docCollection)) {
|
||||
const baseAtom = atom<DocMeta[]>(docCollection.meta.docMetas);
|
||||
const baseAtom = atom<DocMeta[]>([...docCollection.meta.docMetas]);
|
||||
weakMap.set(docCollection, baseAtom);
|
||||
baseAtom.onMount = set => {
|
||||
set(docCollection.meta.docMetas);
|
||||
set([...docCollection.meta.docMetas]);
|
||||
const dispose = docCollection.meta.docMetaUpdated.on(() => {
|
||||
set(docCollection.meta.docMetas);
|
||||
set([...docCollection.meta.docMetas]);
|
||||
});
|
||||
return () => {
|
||||
dispose.dispose();
|
||||
|
||||
@@ -6,10 +6,12 @@ import { useDocCollectionPage } from './use-block-suite-workspace-page';
|
||||
|
||||
const weakMap = new WeakMap<Doc, Atom<string[]>>();
|
||||
function getPageBacklinks(page: Doc): string[] {
|
||||
return page.collection.indexer.backlink
|
||||
.getBacklink(page.id)
|
||||
.map(linkNode => linkNode.pageId)
|
||||
.filter(id => id !== page.id);
|
||||
return (
|
||||
page.collection.indexer.backlink
|
||||
?.getBacklink(page.id)
|
||||
.map(linkNode => linkNode.pageId)
|
||||
.filter(id => id !== page.id) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
const getPageBacklinksAtom = (page: Doc | null) => {
|
||||
@@ -24,13 +26,13 @@ const getPageBacklinksAtom = (page: Doc | null) => {
|
||||
page.slots.ready.on(() => {
|
||||
set(getPageBacklinks(page));
|
||||
}),
|
||||
page.collection.indexer.backlink.slots.indexUpdated.on(() => {
|
||||
page.collection.indexer.backlink?.slots.indexUpdated.on(() => {
|
||||
set(getPageBacklinks(page));
|
||||
}),
|
||||
];
|
||||
set(getPageBacklinks(page));
|
||||
return () => {
|
||||
disposables.forEach(disposable => disposable.dispose());
|
||||
disposables.forEach(disposable => disposable?.dispose());
|
||||
};
|
||||
};
|
||||
weakMap.set(page, baseAtom);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useDocCollectionPage } from './use-block-suite-workspace-page';
|
||||
const weakMap = new WeakMap<Doc, Atom<string[]>>();
|
||||
function getPageReferences(page: Doc): string[] {
|
||||
return Object.values(
|
||||
page.collection.indexer.backlink.linkIndexMap[page.id] ?? {}
|
||||
page.collection.indexer.backlink?.linkIndexMap[page.id] ?? {}
|
||||
).flatMap(linkNodes => linkNodes.map(linkNode => linkNode.pageId));
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ const getPageReferencesAtom = (page: Doc | null) => {
|
||||
page.slots.ready.on(() => {
|
||||
set(getPageReferences(page));
|
||||
}),
|
||||
page.collection.indexer.backlink.slots.indexUpdated.on(() => {
|
||||
page.collection.indexer.backlink?.slots.indexUpdated.on(() => {
|
||||
set(getPageReferences(page));
|
||||
}),
|
||||
];
|
||||
set(getPageReferences(page));
|
||||
return () => {
|
||||
disposables.forEach(disposable => disposable.dispose());
|
||||
disposables.forEach(disposable => disposable?.dispose());
|
||||
};
|
||||
};
|
||||
weakMap.set(page, baseAtom);
|
||||
|
||||
Reference in New Issue
Block a user