1
0
Fork 0
mirror of synced 2024-09-29 16:51:33 +13:00

Simplify loading logic to prevent empty state flashing when loading data in data providers

This commit is contained in:
Andrew Kingston 2021-05-13 16:33:19 +01:00
parent a551f3c8ae
commit d8bbb5e06d
2 changed files with 5 additions and 6 deletions

View file

@ -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,

View file

@ -114,7 +114,6 @@
sortType,
paginate
) => {
console.log("FETCH")
loading = true
if (dataSource?.type === "table") {
const res = await API.searchTable({
@ -248,7 +247,7 @@
<div use:styleable={$component.styles} class="container">
<Provider {actions} data={dataContext}>
{#if !loaded && loading}
{#if !loaded}
<div class="loading">
<ProgressCircle />
</div>