From 617d2d32b3d7ff337910b3b2b8ad79cd1b9b2ab8 Mon Sep 17 00:00:00 2001 From: monoid Date: Tue, 16 Apr 2024 22:18:49 +0900 Subject: [PATCH] fix: z-index and allow tags --- .../client/src/components/gallery/TagInput.tsx | 2 +- packages/client/src/hook/useSearchGallery.ts | 8 ++++++-- packages/client/src/page/galleryPage.tsx | 16 +++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/client/src/components/gallery/TagInput.tsx b/packages/client/src/components/gallery/TagInput.tsx index 7a06e08..23774fb 100644 --- a/packages/client/src/components/gallery/TagInput.tsx +++ b/packages/client/src/components/gallery/TagInput.tsx @@ -155,7 +155,7 @@ export default function TagInput({ { openInfo &&
getScrollElement: () => parentRef.current!, estimateSize: (index) => { + if (!data) return 8; const docs = data?.[index]; if (!docs) return 8; return docs.data.length * (200 + 8) + 37 + 8; @@ -34,10 +35,11 @@ export default function Gallery() { overscan: 1, }); + + const virtualItems = virtualizer.getVirtualItems(); useEffect(() => { const lastItems = virtualItems.slice(-1); - // console.log(virtualItems); if (lastItems.some(x => x.index >= size - 1)) { const last = lastItems[0]; const docs = data?.[last.index]; @@ -47,6 +49,10 @@ export default function Gallery() { } }, [virtualItems, setSize, size, data]); + useEffect(() => { + virtualizer.measure(); + }, [virtualizer, data]); + if (isLoading) { return
Loading...
} @@ -62,10 +68,10 @@ export default function Gallery() { return (
{(word || tags) && -
+
{word && Search: {word}} - {tags && Tags:
    { - tags.split(",").map(x => )} + {tags && Tags:
      { + tags.map(x => )}
    }
}