From 43f5572779f54cee0a73854f0c4fe7bbec35cc2c Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Thu, 20 Jul 2023 17:08:53 -0300
Subject: empty list when loading

---
 packages/aml-backoffice-ui/src/pages/Cases.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'packages/aml-backoffice-ui/src/pages/Cases.tsx')

diff --git a/packages/aml-backoffice-ui/src/pages/Cases.tsx b/packages/aml-backoffice-ui/src/pages/Cases.tsx
index d96e7a90c..8b115ed7e 100644
--- a/packages/aml-backoffice-ui/src/pages/Cases.tsx
+++ b/packages/aml-backoffice-ui/src/pages/Cases.tsx
@@ -87,7 +87,7 @@ export function Cases() {
   if (!list.ok && !list.loading) {
     return handleNotOkResult(i18n)(list);
   }
-
+  const records = list.loading ? [] : list.data.records
   return (
     <div>
       <div class="px-4 sm:px-6 lg:px-8">
@@ -130,7 +130,7 @@ export function Cases() {
         </div>
         <div class="mt-8 flow-root">
           <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
-            {!list.data.records.length ? (
+            {!records.length ? (
               <div>empty result </div>
             ) : (
               <div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
@@ -159,7 +159,7 @@ export function Cases() {
                     </tr>
                   </thead>
                   <tbody class="divide-y divide-gray-200 bg-white">
-                    {list.data.records.map((r) => {
+                    {records.map((r) => {
                       return (
                         <tr class="hover:bg-gray-100 ">
                           <td class="whitespace-nowrap px-3 py-5 text-sm text-gray-500 ">
-- 
cgit v1.2.3

