diff --git a/pkg/interface/src/views/apps/links/components/LinkBlocks.tsx b/pkg/interface/src/views/apps/links/components/LinkBlocks.tsx index 755168967f..a378298bf8 100644 --- a/pkg/interface/src/views/apps/links/components/LinkBlocks.tsx +++ b/pkg/interface/src/views/apps/links/components/LinkBlocks.tsx @@ -32,7 +32,7 @@ export function LinkBlocks(props: LinkBlocksProps) { const [linkSize, setLinkSize] = useState(250); const linkSizePx = `${linkSize}px`; - const isMobile = useLocalState(s => s.mobile); + const isMobile = useLocalState(s => s.mobile || s.mdBreak); const colCount = useMemo(() => (isMobile ? 2 : 4), [isMobile]); const bind = useResize( useCallback( @@ -46,12 +46,13 @@ export function LinkBlocks(props: LinkBlocksProps) { ); useEffect(() => { - const unreads = useHarkState.getState() - .unreads.graph?.[association.resource]?.['/']?.unreads || new Set(); - Array.from((unreads as Set)).forEach((u) => { + const unreads = + useHarkState.getState().unreads.graph?.[association.resource]?.['/'] + ?.unreads || new Set(); + Array.from(unreads as Set).forEach((u) => { airlock.poke(markEachAsRead(association.resource, '/', u)); }); -}, [association.resource]); + }, [association.resource]); const orm = useMemo(() => { const nodes = [null, ...Array.from(props.graph)]; @@ -62,12 +63,12 @@ export function LinkBlocks(props: LinkBlocksProps) { return [bigInt(i), chunk]; }) ); - }, [props.graph]); + }, [props.graph, colCount]); const renderItem = useCallback( React.forwardRef(({ index }, ref) => { - const chunk = orm.get(index); - const space = [3,4]; + const chunk = orm.get(index) ?? []; + const space = [3, 3, 4]; return ( { if (!block) { return ( - + ); } const [i, node] = block; @@ -115,7 +113,13 @@ export function LinkBlocks(props: LinkBlocksProps) { ); return ( - +