Merge pull request #10176 from Budibase/bug/budi-6631-define-existing-relationships-doesnt

[BUG] Refresh sql columns on defining relationships
This commit is contained in:
Adria Navarro 2023-03-31 13:00:58 +02:00 committed by GitHub
commit ceba91fd5c
2 changed files with 14 additions and 0 deletions

View File

@ -136,6 +136,7 @@
const onUpdateColumns = () => {
selectedRows = []
fetch.refresh()
tables.fetchTable(id)
}
// Fetch data whenever rows are modified. Unfortunately we have to lose

View File

@ -22,6 +22,18 @@ export function createTablesStore() {
}))
}
const fetchTable = async tableId => {
const table = await API.fetchTableDefinition(tableId)
store.update(state => {
const indexToUpdate = state.list.findIndex(t => t._id === table._id)
state.list[indexToUpdate] = table
return {
...state,
}
})
}
const select = tableId => {
store.update(state => ({
...state,
@ -126,6 +138,7 @@ export function createTablesStore() {
return {
subscribe: derivedStore.subscribe,
fetch,
fetchTable,
init: fetch,
select,
save,