UnjoinedResource: fix crash

This commit is contained in:
Liam Fitzgerald 2021-03-10 17:17:55 +10:00
parent 9c5b82237e
commit d82e886e2a
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -24,9 +24,9 @@ function isJoined(path: string) {
return function (
props: Pick<UnjoinedResourceProps, 'graphKeys'>
) {
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);