1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

🐛 Use Boolean to filter the resources array

This commit is contained in:
Steffo 2021-11-08 04:57:47 +01:00 committed by Stefano Pigozzi
parent 95b28eaa21
commit 38a9b8baef
3 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@ export function GroupListBox({viewSet}: GroupListBoxProps): JSX.Element {
if(viewSet.resources.length === 0) { if(viewSet.resources.length === 0) {
return <Empty>This Sophon instance has no groups.</Empty> return <Empty>This Sophon instance has no groups.</Empty>
} }
return viewSet.resources?.filter(res => res !== undefined).map(res => <GroupResourcePanel resource={res} key={res.value?.slug}/>) return viewSet.resources?.filter(res => Boolean(res)).map(res => <GroupResourcePanel resource={res} key={res.value?.slug}/>)
}, },
[viewSet], [viewSet],
) )

View file

@ -21,7 +21,7 @@ export function NotebookListBox({viewSet}: NotebookListBoxProps): JSX.Element {
if(viewSet.resources.length === 0) { if(viewSet.resources.length === 0) {
return <Empty>This project has no notebooks.</Empty> return <Empty>This project has no notebooks.</Empty>
} }
return viewSet.resources?.filter(res => res !== undefined).map(res => <NotebookResourcePanel resource={res} key={res.value.slug}/>) return viewSet.resources?.filter(res => Boolean(res)).map(res => <NotebookResourcePanel resource={res} key={res.value.slug}/>)
}, },
[viewSet], [viewSet],
) )

View file

@ -21,7 +21,7 @@ export function ProjectListBox({viewSet}: ProjectListBoxProps): JSX.Element {
if(viewSet.resources.length === 0) { if(viewSet.resources.length === 0) {
return <Empty>This group owns no projects.</Empty> return <Empty>This group owns no projects.</Empty>
} }
return viewSet.resources?.filter(res => res !== undefined).map(res => <ProjectResourcePanel resource={res} key={res.value.slug}/>) return viewSet.resources?.filter(res => Boolean(res)).map(res => <ProjectResourcePanel resource={res} key={res.value.slug}/>)
}, },
[viewSet], [viewSet],
) )