Просмотр исходного кода

fix the 'Cannot stringify non POJO' error

Olivier Massot 1 год назад
Родитель
Сommit
d6337f65e8
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      services/data/entityManager.ts

+ 9 - 1
services/data/entityManager.ts

@@ -240,7 +240,7 @@ class EntityManager {
       piniaOrmQuery = query.applyToPiniaOrmQuery(piniaOrmQuery)
       piniaOrmQuery = query.applyToPiniaOrmQuery(piniaOrmQuery)
     }
     }
 
 
-    return computed(() => {
+    const res = computed(() => {
       const items: PiniaOrmCollection<ApiResource> = piniaOrmQuery.get()
       const items: PiniaOrmCollection<ApiResource> = piniaOrmQuery.get()
 
 
       return {
       return {
@@ -254,6 +254,14 @@ class EntityManager {
         },
         },
       }
       }
     })
     })
+
+    // @ts-expect-error Needed to avoid 'Cannot stringify non POJO' occasional bugs
+    // eslint-disable-next-line
+    res.toJSON = () => {
+      return 'Computed result from fetchCollection at : ' + url
+    }
+
+    return res
   }
   }
 
 
   /**
   /**