fix table flashing with no data

This commit is contained in:
Sidney Alcantara
2022-06-14 12:50:18 +10:00
parent ea7a6e92e4
commit c1eaadd051
2 changed files with 21 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ import {
tableScope,
tableIdAtom,
tableSettingsAtom,
tableSchemaAtom,
} from "@src/atoms/tableScope";
/**
@@ -57,9 +58,18 @@ export default function ProvidedTablePage() {
>
<DebugAtoms scope={tableScope} />
<TableSourceFirestore />
<main>
<TablePage />
</main>
<Suspense
fallback={
<>
<TableToolbarSkeleton />
<TableSkeleton />
</>
}
>
<main>
<TablePage />
</main>
</Suspense>
<Suspense fallback={null}>
<Outlet />
</Suspense>

View File

@@ -46,6 +46,14 @@ export default function TablePage() {
// A ref to the data grid. Contains data grid functions
const dataGridRef = useRef<DataGridHandle | null>(null);
if (!(tableSchema as any)._rowy_ref)
return (
<>
<TableToolbarSkeleton />
<TableSkeleton />
</>
);
if (isEmpty(tableSchema.columns))
return (
<Suspense fallback={null}>