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.

feat(core): lazy load doc card (#9192)

EYHN8374346b2e37
diff --git a/packages/frontend/core/src/mobile/components/doc-card/index.tsx b/packages/frontend/core/src/mobile/components/doc-card/index.tsx
index c4dcec17f2..333f6a0cc7 100644
--- a/packages/frontend/core/src/mobile/components/doc-card/index.tsx
+++ b/packages/frontend/core/src/mobile/components/doc-card/index.tsx
@@ -102,30 +102,35 @@ export const DocCard = forwardRef<HTMLAnchorElement, DocCardProps>(
data-visible={visible}
{...attrs}
>
- <header className={styles.head} data-testid="doc-card-header">
- <h3 className={styles.title}>{title}</h3>
- <IconButton
- aria-label="favorite"
- icon={
- <IsFavoriteIcon onClick={toggleFavorite} favorite={favorited} />
- }
- />
- </header>
- <main className={styles.content} style={contentStyle}>
- {visible && (
- <PagePreview
- fallback={
- <>
- <Skeleton />
- <Skeleton width={'60%'} />
- </>
- }
- pageId={meta.id}
- emptyFallback={<div className={styles.contentEmpty}>Empty</div>}
- />
- )}
- </main>
- {showTags ? <DocCardTags docId={meta.id} rows={2} /> : null}
+ {visible && (
+ <>
+ <header className={styles.head} data-testid="doc-card-header">
+ <h3 className={styles.title}>{title}</h3>
+ <IconButton
+ aria-label="favorite"
+ icon={
+ <IsFavoriteIcon
+ onClick={toggleFavorite}
+ favorite={favorited}
+ />
+ }
+ />
+ </header>
+ <main className={styles.content} style={contentStyle}>
+ <PagePreview
+ fallback={
+ <>
+ <Skeleton />
+ <Skeleton width={'60%'} />
+ </>
+ }
+ pageId={meta.id}
+ emptyFallback={<div className={styles.contentEmpty}>Empty</div>}
+ />
+ </main>
+ {showTags ? <DocCardTags docId={meta.id} rows={2} /> : null}
+ </>
+ )}
</WorkbenchLink>
);
}