From f2385607215dca89875fd6303d99e40e03e37bfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadeusz=20Miesi=C4=85c?= <tadeusz.miesiac@gmail.com>
Date: Thu, 19 Oct 2023 21:39:07 +0800
Subject: [PATCH] fix(pr fixes): pr fixes

---
 .../PinsListItem.component.utils.ts           | 24 +++++++------------
 src/redux/drawer/drawer.selectors.ts          | 10 +++++---
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.utils.ts b/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.utils.ts
index 873de967..4e4cb8ee 100644
--- a/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.utils.ts
+++ b/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.utils.ts
@@ -1,19 +1,13 @@
-import { assertNever } from '@/utils/assertNever';
 import { PinType } from '../PinsList.types';
 
 export const getPinColor = (type: PinType): string => {
-  switch (type) {
-    case 'bioEntity':
-      return 'fill-primary-500';
-    case 'drugs':
-      return 'fill-orange';
-    case 'chemicals':
-      return 'fill-purple';
-    case 'mirna':
-      return 'fill-primary-500';
-    case 'none':
-      return '';
-    default:
-      return assertNever(type);
-  }
+  const pinColors: Record<PinType, string> = {
+    bioEntity: 'fill-primary-500',
+    drugs: 'fill-orange',
+    chemicals: 'fill-purple',
+    mirna: 'fill-primary-500',
+    none: 'none',
+  };
+
+  return pinColors[type];
 };
diff --git a/src/redux/drawer/drawer.selectors.ts b/src/redux/drawer/drawer.selectors.ts
index b928a6bd..6c8a5e3a 100644
--- a/src/redux/drawer/drawer.selectors.ts
+++ b/src/redux/drawer/drawer.selectors.ts
@@ -31,13 +31,13 @@ export const resultListSelector = createSelector(rootSelector, state => {
 
   switch (selectedType) {
     case 'drugs':
-      return state.drugs.data!.map(drug => ({
+      return (state.drugs.data || []).map(drug => ({
         id: drug.id,
         name: drug.name,
         data: drug,
       }));
     case 'chemicals':
-      return state.chemicals.data!.map(chemical => ({
+      return (state.chemicals.data || []).map(chemical => ({
         id: chemical.id.id,
         name: chemical.name,
         data: chemical,
@@ -45,7 +45,11 @@ export const resultListSelector = createSelector(rootSelector, state => {
     case 'bioEntity':
       return undefined;
     case 'mirna':
-      return state.mirnas.data!.map(mirna => ({ id: mirna.id, name: mirna.name, data: mirna }));
+      return (state.mirnas.data || []).map(mirna => ({
+        id: mirna.id,
+        name: mirna.name,
+        data: mirna,
+      }));
     case 'none':
       return undefined;
     default:
-- 
GitLab