Skip to content

Commit

Permalink
fixed issue with table columns loading and resetting tabulator
Browse files Browse the repository at this point in the history
  • Loading branch information
rathboma committed Dec 13, 2023
1 parent 744d50a commit 837ea23
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/studio/src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function initUserDirectory(d: string) {

const transports = [log.transports.console, log.transports.file]
if (platformInfo.isDevelopment || platformInfo.debugEnabled) {
transports.forEach(t => t.level = 'debug')
transports.forEach(t => t.level = 'silly')
} else {
transports.forEach(t => t.level = 'warn')
}
Expand Down
10 changes: 9 additions & 1 deletion apps/studio/src/components/common/TabWithTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@

<script lang="ts">
import Vue from 'vue'
import rawLog from 'electron-log'
import { mapState } from 'vuex'
const log = rawLog.scope('TabWithTable')
export default Vue.extend({
props: ['tab'],
computed: {
...mapState(['tables', 'tablesInitialLoaded']),
table() {
console.log("table changed")
return this.tab.findTable(this.tables)
},
},
watch: {
table() {
log.debug("table changed!", this.table)
}
}
})
</script>
Expand Down
12 changes: 8 additions & 4 deletions apps/studio/src/components/tableinfo/TableRelations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export default Vue.extend({
editable,
editor: 'list',
editorParams: {
values: this.table.columns.map((c) => escapeHtml(c.columnName))
// @ts-expect-error Incorrectly typed
valuesLookup: () => this.table.columns.map((c) => escapeHtml(c.columnName))
}
},
...( showSchema ? [{
Expand All @@ -206,7 +207,8 @@ export default Vue.extend({
editable,
editor: 'list' as any,
editorParams: {
values: this.schemas.map((s) => escapeHtml(s))
// @ts-expect-error Incorrectly typed
valuesLookup: () => this.schemas.map((s) => escapeHtml(s))
},
cellEdited: (cell) => cell.getRow().getCell('toTable')?.setValue(null)
}] : []),
Expand Down Expand Up @@ -297,8 +299,10 @@ export default Vue.extend({
await this.$store.dispatch('updateTableColumns', tableData)
tableData = this.findTable(schema, table)
}
return await tableData.columns.map((c: TableColumn) => escapeHtml(c.columnName)) || []
const result = await tableData.columns.map((c: TableColumn) => escapeHtml(c.columnName)) || []
console.log("getcolumns", result)
return result
},
getPayload(): RelationAlterations {
const additions: CreateRelationSpec[] = this.newRows.map((row: RowComponent) => {
Expand Down
1 change: 1 addition & 0 deletions shared/src/lib/tabulator/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const TabulatorStateWatchers = {
table: {
deep: true,
handler() {
log.debug("table changed - initializing Tabulator")
this.initializeTabulator()
}
}
Expand Down

0 comments on commit 837ea23

Please sign in to comment.