Improve grid handling of invalid datasources and fix potential error when encoutering invalid datasources
This commit is contained in:
parent
c4a516ccb3
commit
77f87af87f
|
@ -141,7 +141,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $loaded}
|
{#if $error}
|
||||||
|
<div class="grid-error">
|
||||||
|
<div class="grid-error-title">There was a problem loading your grid</div>
|
||||||
|
<div class="grid-error-subtitle">
|
||||||
|
{$error}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else if $loaded}
|
||||||
<div class="grid-data-outer" use:clickOutside={ui.actions.blur}>
|
<div class="grid-data-outer" use:clickOutside={ui.actions.blur}>
|
||||||
<div class="grid-data-inner">
|
<div class="grid-data-inner">
|
||||||
<StickyColumn>
|
<StickyColumn>
|
||||||
|
@ -171,13 +178,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if $error}
|
|
||||||
<div class="grid-error">
|
|
||||||
<div class="grid-error-title">There was a problem loading your grid</div>
|
|
||||||
<div class="grid-error-subtitle">
|
|
||||||
{$error}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if $loading && !$error}
|
{#if $loading && !$error}
|
||||||
<div in:fade|local={{ duration: 130 }} class="grid-loading">
|
<div in:fade|local={{ duration: 130 }} class="grid-loading">
|
||||||
|
|
|
@ -94,12 +94,14 @@ export const createActions = context => {
|
||||||
datasource.subscribe(async $datasource => {
|
datasource.subscribe(async $datasource => {
|
||||||
// Unsub from previous fetch if one exists
|
// Unsub from previous fetch if one exists
|
||||||
unsubscribe?.()
|
unsubscribe?.()
|
||||||
|
unsubscribe = null
|
||||||
fetch.set(null)
|
fetch.set(null)
|
||||||
instanceLoaded.set(false)
|
instanceLoaded.set(false)
|
||||||
loading.set(true)
|
loading.set(true)
|
||||||
|
|
||||||
// Abandon if we don't have a valid datasource
|
// Abandon if we don't have a valid datasource
|
||||||
if (!datasource.actions.isDatasourceValid($datasource)) {
|
if (!datasource.actions.isDatasourceValid($datasource)) {
|
||||||
|
error.set("Datasource is invalid")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue