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 => )}
    }
}