From 3a8e217bb752b4763791a681a90bd1be93bda712 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 17 Dec 2021 09:18:43 +0000 Subject: [PATCH] Delay rendering blocks until the schema has been attempted to be loaded --- .../components/app/blocks/CardsBlock.svelte | 164 +++++++++--------- .../components/app/blocks/TableBlock.svelte | 88 +++++----- 2 files changed, 128 insertions(+), 124 deletions(-) diff --git a/packages/client/src/components/app/blocks/CardsBlock.svelte b/packages/client/src/components/app/blocks/CardsBlock.svelte index 49c4ef5b8b..349dbf9074 100644 --- a/packages/client/src/components/app/blocks/CardsBlock.svelte +++ b/packages/client/src/components/app/blocks/CardsBlock.svelte @@ -45,6 +45,7 @@ let dataProviderId let repeaterId let schema + let schemaLoaded = false $: fetchSchema(dataSource) $: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema) @@ -113,101 +114,104 @@ if (dataSource) { schema = await fetchDatasourceSchema(dataSource) } + schemaLoaded = true } - -
- - {#if title || enrichedSearchColumns?.length || showTitleButton} -
-
- {title || ""} +{#if schemaLoaded} + +
+ + {#if title || enrichedSearchColumns?.length || showTitleButton} +
+
+ {title || ""} +
+
+ {#if enrichedSearchColumns?.length} + + {/if} + {#if showTitleButton} + + {/if} +
-
- {#if enrichedSearchColumns?.length} - - {/if} - {#if showTitleButton} - - {/if} -
-
- {/if} - + {/if} + > + + - -
- +
+ +{/if}