1
0
Fork 0
mirror of synced 2024-06-03 02:55:14 +12:00

Refactor some app components to remove dependency on static props

This commit is contained in:
Andrew Kingston 2021-11-16 17:52:00 +00:00
parent cc5e42e933
commit 69422f374b
3 changed files with 11 additions and 9 deletions

View file

@ -1,5 +1,5 @@
<script>
import { onMount, getContext } from "svelte"
import { getContext } from "svelte"
import Block from "components/Block.svelte"
import BlockComponent from "components/BlockComponent.svelte"
import { Heading } from "@budibase/bbui"
@ -46,6 +46,7 @@
let repeaterId
let schema
$: fetchSchema(dataSource)
$: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema)
$: enrichedFilter = enrichFilter(filter, enrichedSearchColumns, formId)
$: cardWidth = cardHorizontal ? 420 : 300
@ -107,12 +108,12 @@
return `${split[0]}/{{ ${safe(repeaterId)}.${safe(col)} }}`
}
// Load the datasource schema on mount so we can determine column types
onMount(async () => {
// Load the datasource schema so we can determine column types
const fetchSchema = async dataSource => {
if (dataSource) {
schema = await API.fetchDatasourceSchema(dataSource)
}
})
}
</script>
<Block>

View file

@ -1,5 +1,5 @@
<script>
import { onMount, getContext } from "svelte"
import { getContext } from "svelte"
import Block from "components/Block.svelte"
import BlockComponent from "components/BlockComponent.svelte"
import { Heading } from "@budibase/bbui"
@ -41,6 +41,7 @@
let dataProviderId
let schema
$: fetchSchema(dataSource)
$: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema)
$: enrichedFilter = enrichFilter(filter, enrichedSearchColumns, formId)
$: titleButtonAction = [
@ -85,12 +86,12 @@
return enrichedColumns.slice(0, 3)
}
// Load the datasource schema on mount so we can determine column types
onMount(async () => {
// Load the datasource schema so we can determine column types
const fetchSchema = async dataSource => {
if (dataSource) {
schema = await API.fetchDatasourceSchema(dataSource)
}
})
}
</script>
<Block>

View file

@ -1,5 +1,5 @@
<script>
import { getContext, onMount } from "svelte"
import { getContext } from "svelte"
import InnerForm from "./InnerForm.svelte"
import { hashString } from "utils/helpers"