From 3564fd56211d55b6f6b530cd5cf98d691acb9ed5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 5 Oct 2023 19:30:00 +0100 Subject: [PATCH] Improve handling of JSON objects in custom datasources --- packages/frontend-core/src/fetch/CustomFetch.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/frontend-core/src/fetch/CustomFetch.js b/packages/frontend-core/src/fetch/CustomFetch.js index 5a92de635a..5b367ec158 100644 --- a/packages/frontend-core/src/fetch/CustomFetch.js +++ b/packages/frontend-core/src/fetch/CustomFetch.js @@ -36,9 +36,7 @@ export default class CustomFetch extends DataFetch { if (typeof data === "string") { try { const js = JSON.parse(data) - if (Array.isArray(js)) { - return js - } + return Array.isArray(js) ? js : [js] } catch (error) { // Ignore }