Only refresh tables when table ID changes

This commit is contained in:
Andrew Kingston 2021-09-23 17:04:12 +01:00
parent 6c8bff19e9
commit 13163102f8
1 changed files with 10 additions and 8 deletions

View File

@ -13,22 +13,24 @@
import { fetchTableData } from "helpers/fetchTableData" import { fetchTableData } from "helpers/fetchTableData"
import { Pagination } from "@budibase/bbui" import { Pagination } from "@budibase/bbui"
let hideAutocolumns = true
const data = fetchTableData() const data = fetchTableData()
let hideAutocolumns = true
$: isUsersTable = $tables.selected?._id === TableNames.USERS $: isUsersTable = $tables.selected?._id === TableNames.USERS
$: title = $tables.selected?.name $: title = $tables.selected?.name
$: schema = $tables.selected?.schema $: schema = $tables.selected?.schema
$: type = $tables.selected?.type $: type = $tables.selected?.type
$: isInternal = type !== "external" $: isInternal = type !== "external"
$: fetchTable($tables.selected?._id)
// Fetch data whenever table changes const fetchTable = tableId => {
$: data.update({ data.update({
tableId: $tables.selected?._id, tableId,
schema, schema,
limit: 10, limit: 10,
paginate: true, paginate: true,
}) })
}
// Fetch data whenever sorting option changes // Fetch data whenever sorting option changes
const onSort = e => { const onSort = e => {