From a94682d64588d62e77f68e14d4d1edff2f444f3b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 13 May 2021 16:33:19 +0100 Subject: [PATCH] Simplify loading logic to prevent empty state flashing when loading data in data providers --- packages/client/src/api/tables.js | 8 ++++---- packages/standard-components/src/DataProvider.svelte | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/client/src/api/tables.js b/packages/client/src/api/tables.js index a75a2d368b..59381e35bf 100644 --- a/packages/client/src/api/tables.js +++ b/packages/client/src/api/tables.js @@ -23,7 +23,6 @@ export const fetchTableData = async tableId => { export const searchTable = async ({ tableId, query, - raw, bookmark, limit, sort, @@ -31,14 +30,15 @@ export const searchTable = async ({ sortType, paginate, }) => { - if (!tableId || (!query && !raw)) { - return + if (!tableId || !query) { + return { + rows: [], + } } const res = await API.post({ url: `/api/search/${tableId}/rows`, body: { query, - raw, bookmark, limit, sort, diff --git a/packages/standard-components/src/DataProvider.svelte b/packages/standard-components/src/DataProvider.svelte index 66414ac39b..83f30fab86 100644 --- a/packages/standard-components/src/DataProvider.svelte +++ b/packages/standard-components/src/DataProvider.svelte @@ -114,7 +114,6 @@ sortType, paginate ) => { - console.log("FETCH") loading = true if (dataSource?.type === "table") { const res = await API.searchTable({ @@ -248,7 +247,7 @@
- {#if !loaded && loading} + {#if !loaded}