Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/store/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ export const useDataStore = defineStore('data', {
if (!Array.isArray(res.data)) {
const e = new Error('Expected array, but is not')
displayError(e, 'Format for loaded columns not valid.')
return false
return []
}
} catch (e) {
displayError(e, t('tables', 'Could not load columns.'))
return false
return []
}

const columns = res.data.map(col => parseCol(col))
Expand All @@ -90,6 +90,8 @@ export const useDataStore = defineStore('data', {
return orderA - orderB
})
}
} else {
allColumns = allColumns.sort((a, b) => a.id - b.id)
}
const stateId = genStateKey(!!(view?.id), view?.id ?? tableId)
set(this.columns, stateId, allColumns)
Expand All @@ -108,10 +110,11 @@ export const useDataStore = defineStore('data', {
}
} catch (e) {
displayError(e, t('tables', 'Could not load columns.'))
return false
return []
}

const columns = res.data.ocs.data.map(col => parseCol(col))
.sort((a, b) => a.id - b.id)
// Fix up columns to match expected structure if needed
// Public API might return slightly different structure, but parseCol should handle it if it's standard TableColumn

Expand Down
Loading