From d82e886e2a827c37e251711f63353bcc0553d744 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 10 Mar 2021 17:17:55 +1000 Subject: [PATCH] UnjoinedResource: fix crash --- .../src/views/components/UnjoinedResource.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/interface/src/views/components/UnjoinedResource.tsx b/pkg/interface/src/views/components/UnjoinedResource.tsx index 55403d3d2..ab14aed2d 100644 --- a/pkg/interface/src/views/components/UnjoinedResource.tsx +++ b/pkg/interface/src/views/components/UnjoinedResource.tsx @@ -24,9 +24,9 @@ function isJoined(path: string) { return function ( props: Pick ) { - const graphKeys = useGraphState(state => state.graphKeys); + const graphKey = path.substr(7); - return graphKeys.has(graphKey); + return props.graphKeys.has(graphKey); }; } @@ -35,11 +35,12 @@ export function UnjoinedResource(props: UnjoinedResourceProps) { const history = useHistory(); const rid = props.association.resource; const appName = props.association['app-name']; - const { title, description, module } = props.association.metadata; - const waiter = useWaitForProps(props); - const app = useMemo(() => module || appName, [props.association]); + const { title, description, module: mod } = props.association.metadata; const graphKeys = useGraphState(state => state.graphKeys); + const waiter = useWaitForProps({...props, graphKeys }); + const app = useMemo(() => mod || appName, [props.association]); + const onJoin = async () => { const [, , ship, name] = rid.split('/'); await api.graph.joinGraph(ship, name);