diff --git a/src/state/build-section/cell-types.ts b/src/state/build-section/cell-types.ts index 8941ac502..20cf6239b 100644 --- a/src/state/build-section/cell-types.ts +++ b/src/state/build-section/cell-types.ts @@ -41,8 +41,7 @@ export const cellTypesByIdAtom = selectAtom< Promise | null, Promise | undefined> | null >(cellTypesAtom, (cellTypes) => { - if (!cellTypes) return null; - + if (!cellTypes || !cellTypes.hits) return null; return cellTypes.hits.hits.reduce( (acc: Record, classObj: ClassESResponse) => { acc[classObj._source['@id']] = classObj._source; @@ -57,7 +56,7 @@ export const cellTypesByLabelAtom = selectAtom< Promise | null, Promise | undefined> | null >(cellTypesAtom, (cellTypes) => { - if (!cellTypes) return null; + if (!cellTypes || !cellTypes.hits) return null; return cellTypes.hits.hits.reduce( (acc: Record, classObj: ClassESResponse) => {