Skip to content

Commit

Permalink
fix app error flash (#230)
Browse files Browse the repository at this point in the history
#215

Makes the code more null safe when calling functions / accessing array
elements while in the loading state.
  • Loading branch information
codemonkey800 authored Dec 8, 2023
1 parent 8b21d8a commit 918fc1c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function RunsTable() {
<KeyPhoto
title={run.name}
src={
run.tomogram_voxel_spacings[0]?.tomograms[0]
run.tomogram_voxel_spacings?.[0]?.tomograms?.[0]
?.key_photo_thumbnail_url ?? undefined
}
loading={isLoadingDebounced}
Expand Down Expand Up @@ -113,7 +113,7 @@ export function RunsTable() {
const voxelSpacings = getValue()
const annotatedObjects = Array.from(
new Set(
voxelSpacings.flatMap((voxelSpacing) =>
voxelSpacings?.flatMap?.((voxelSpacing) =>
voxelSpacing.annotations.flatMap(
(annotation) => annotation.object_name,
),
Expand Down Expand Up @@ -143,7 +143,7 @@ export function RunsTable() {

columnHelper.accessor(
(run) =>
run.tomogram_voxel_spacings[0]?.tomograms[0]?.neuroglancer_config,
run.tomogram_voxel_spacings?.[0]?.tomograms?.[0]?.neuroglancer_config,
{
id: 'viewTomogram',
header: '',
Expand Down

0 comments on commit 918fc1c

Please sign in to comment.