From 427bb01e51662be681e06832b75b496a17a9b4b9 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 16 Nov 2021 17:51:05 +0000 Subject: [PATCH] Update table to handle dynamic data provider prop --- packages/client/src/components/app/table/Table.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/app/table/Table.svelte b/packages/client/src/components/app/table/Table.svelte index 90bbd84d13..f462b93551 100644 --- a/packages/client/src/components/app/table/Table.svelte +++ b/packages/client/src/components/app/table/Table.svelte @@ -17,10 +17,6 @@ const component = getContext("component") const { styleable, getAction, ActionTypes, routeStore } = getContext("sdk") - const setSorting = getAction( - dataProvider?.id, - ActionTypes.SetDataProviderSorting - ) const customColumnKey = `custom-${Math.random()}` const customRenderers = [ { @@ -29,13 +25,16 @@ }, ] - // Table state $: hasChildren = $component.children $: loading = dataProvider?.loading ?? false $: data = dataProvider?.rows || [] $: fullSchema = dataProvider?.schema ?? {} $: fields = getFields(fullSchema, columns, showAutoColumns) $: schema = getFilteredSchema(fullSchema, fields, hasChildren) + $: setSorting = getAction( + dataProvider?.id, + ActionTypes.SetDataProviderSorting + ) const getFields = (schema, customColumns, showAutoColumns) => { // Check for an invalid column selection