This commit is contained in:
2025-11-14 19:46:18 +01:00
parent a3c5494bf7
commit bd3eab8b40
10 changed files with 53 additions and 53 deletions
@@ -17,7 +17,7 @@ const DEFAULT_THUMBNAIL_SIZE = 48;
// Detect when an element becomes visible within a scroll container so we can delay loading.
const useLazyVisibility = (
rootRef: MutableRefObject<Element | null> | null,
resetKey: string | number | null | undefined,
resetKey?: string | number | null,
) => {
const targetRef = useRef<HTMLDivElement | null>(null);
const [isVisible, setIsVisible] = useState(false);
@@ -66,10 +66,10 @@ const useLazyVisibility = (
return { ref: targetRef, isVisible };
};
const getPageCount = (doc: DocumentLike | null | undefined) =>
Number.isFinite(doc?.current_version?.metadata?.page_count)
? (doc?.current_version?.metadata?.page_count as number)
: null;
const getPageCount = (doc?: DocumentLike | null) => {
const count = doc?.current_version?.metadata?.page_count;
return Number.isFinite(count) ? Number(count) : null;
};
type DocumentLike = AssetManagerDocumentLike;
type AssetLike = AssetManagerAssetLike;