links: return submit if no 'first item'

Fixes unfiled bug where creating a new collection returned a blank
screen.
This commit is contained in:
Matilde Park 2021-01-23 12:34:16 -05:00
parent c442aac74e
commit 48f34795da

View File

@ -48,10 +48,9 @@ export function LinkWindow(props: LinkWindowProps) {
}, [graph.size]); }, [graph.size]);
const first = graph.peekLargest()?.[0]; const first = graph.peekLargest()?.[0];
const [,,ship, name] = association['app-path'].split('/'); const [,,ship, name] = association['app-path'].split('/');
const style = useMemo(() => const style = useMemo(() =>
({ ({
height: "100%", height: "100%",
width: "100%", width: "100%",
@ -60,6 +59,14 @@ export function LinkWindow(props: LinkWindowProps) {
alignItems: 'center' alignItems: 'center'
}), []); }), []);
if (!first) {
return (
<Col key={0} mx="auto" mt="4" maxWidth="768px" width="100%" flexShrink={0} px={3}>
<LinkSubmit s3={props.s3} name={name} ship={ship.slice(1)} api={api} />
</Col>
);
}
return ( return (
<VirtualScroller <VirtualScroller
ref={(l) => (virtualList.current = l ?? undefined)} ref={(l) => (virtualList.current = l ?? undefined)}
@ -82,7 +89,7 @@ export function LinkWindow(props: LinkWindowProps) {
if(index.eq(first ?? bigInt.zero)) { if(index.eq(first ?? bigInt.zero)) {
return ( return (
<> <>
<Col key={index.toString()} mx="auto" mt="4" maxWidth="768px" width="100%" flexShrink='0' px={3}> <Col key={index.toString()} mx="auto" mt="4" maxWidth="768px" width="100%" flexShrink={0} px={3}>
<LinkSubmit s3={props.s3} name={name} ship={ship.slice(1)} api={api} /> <LinkSubmit s3={props.s3} name={name} ship={ship.slice(1)} api={api} />
</Col> </Col>
<LinkItem {...linkProps} /> <LinkItem {...linkProps} />