Fix refreshing table definition

This commit is contained in:
Andrew Kingston 2023-07-27 14:22:13 +01:00
parent deb4092cd3
commit 24182b3f1b
2 changed files with 12 additions and 5 deletions

View File

@ -11,5 +11,7 @@
</script> </script>
<Modal bind:this={modal}> <Modal bind:this={modal}>
<CreateEditColumn on:updatecolumns={rows.actions.refreshTableDefinition} /> <CreateEditColumn
on:updatecolumns={rows.actions.refreshDatasourceDefinition}
/>
</Modal> </Modal>

View File

@ -482,9 +482,14 @@ export const createActions = context => {
} }
// Refreshes the schema of the data fetch subscription // Refreshes the schema of the data fetch subscription
const refreshTableDefinition = async () => { const refreshDatasourceDefinition = async () => {
const definition = await API.fetchTableDefinition(get(tableId)) const $datasource = get(datasource)
table.set(definition) if ($datasource.type === "table") {
table.set(await API.fetchTableDefinition($datasource.tableId))
} else if ($datasource.type === "viewV2") {
// const definition = await API.viewsV2.(get(tableId))
// table.set(definition)
}
} }
// Checks if we have a row with a certain ID // Checks if we have a row with a certain ID
@ -520,7 +525,7 @@ export const createActions = context => {
refreshRow, refreshRow,
replaceRow, replaceRow,
refreshData, refreshData,
refreshTableDefinition, refreshDatasourceDefinition,
}, },
}, },
} }