Merge pull request #5204 from urbit/lf/handle-undef-assoc

interface: Handle undefined association in getFeedPath
This commit is contained in:
fang 2021-10-04 21:22:09 +02:00 committed by GitHub
commit d606ba61d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,8 +56,11 @@ export function parentPath(path: string) {
* string -> enabled feed
*/
export function getFeedPath(association: Association): string | null | undefined {
const { metadata = { config: {} } } = association;
if (metadata.config && 'group' in metadata?.config && metadata.config?.group) {
const metadata = association?.metadata;
if(!metadata) {
return undefined;
}
if (metadata?.config && 'group' in metadata?.config && metadata.config?.group) {
if ('resource' in metadata.config.group) {
return metadata.config.group.resource;
}