Merge pull request #15318 from Budibase/fix/view-v1-data

Fix issues when fetching view v1 data
This commit is contained in:
Adria Navarro 2025-01-07 18:29:55 +01:00 committed by GitHub
commit a23304e27f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -84,9 +84,9 @@ export const patchAPI = API => {
} }
} }
const fetchViewData = API.fetchViewData const fetchViewData = API.fetchViewData
API.fetchViewData = async params => { API.fetchViewData = async (viewName, params) => {
const tableId = params?.tableId const tableId = params?.tableId
const rows = await fetchViewData(params) const rows = await fetchViewData(viewName, params)
return await enrichRows(rows, tableId) return await enrichRows(rows, tableId)
} }

View File

@ -8,9 +8,15 @@ export default class ViewFetch extends DataFetch {
async getData() { async getData() {
const { datasource } = this.options const { datasource } = this.options
try { try {
const res = await this.API.fetchViewData(datasource.name) const res = await this.API.fetchViewData(datasource.name, {
calculation: datasource.calculation,
field: datasource.field,
groupBy: datasource.groupBy,
tableId: datasource.tableId,
})
return { rows: res || [] } return { rows: res || [] }
} catch (error) { } catch (error) {
console.error(error)
return { rows: [] } return { rows: [] }
} }
} }