瀏覽代碼

fix the 'Cannot stringify non POJO' error

Olivier Massot 1 年之前
父節點
當前提交
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)
     }
 
-    return computed(() => {
+    const res = computed(() => {
       const items: PiniaOrmCollection<ApiResource> = piniaOrmQuery.get()
 
       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
   }
 
   /**