Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: workspace image flickering (#1247)

Himself65e67411aea45a
diff --git a/apps/web/src/hooks/use-workspace-blob.ts b/apps/web/src/hooks/use-workspace-blob.ts
index 935d5b9289..6619f65e3f 100644
--- a/apps/web/src/hooks/use-workspace-blob.ts
+++ b/apps/web/src/hooks/use-workspace-blob.ts
@@ -22,9 +22,16 @@ export function useWorkspaceBlobImage(
const blobStorage = useWorkspaceBlob(blockSuiteWorkspace);
const [imageURL, setImageURL] = useState<string | null>(null);
useEffect(() => {
+ const controller = new AbortController();
blobStorage?.get(key).then(blob => {
+ if (controller.signal.aborted) {
+ return;
+ }
setImageURL(blob);
});
+ return () => {
+ controller.abort();
+ };
}, [blobStorage, key]);
return imageURL;
}