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

🐛 Filter out undefined elements in ListBoxes

This commit is contained in:
Steffo 2021-10-23 00:52:57 +02:00
parent f66ecf67fe
commit da19f099e6
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?.map(res => <GroupResourcePanel resource={res} key={res.value?.slug}/>) return viewSet.resources?.filter(res => res !== undefined).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?.map(res => <NotebookResourcePanel resource={res} key={res.value.slug}/>) return viewSet.resources?.filter(res => res !== undefined).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?.map(res => <ProjectResourcePanel resource={res} key={res.value.slug}/>) return viewSet.resources?.filter(res => res !== undefined).map(res => <ProjectResourcePanel resource={res} key={res.value.slug}/>)
}, },
[viewSet], [viewSet],
) )