Browse Source

Fix issue with determining view schema

master
Andrew Kingston 5 years ago
parent
commit
9a53982038
  1. 5
      packages/client/src/utils/fetch/DataFetch.js
  2. 7
      packages/client/src/utils/fetch/ViewFetch.js

5
packages/client/src/utils/fetch/DataFetch.js

@ -166,7 +166,7 @@ export default class DataFetch {
*/ */
async getPage() { async getPage() {
const { sortColumn, sortOrder, sortType, limit } = this.options const { sortColumn, sortOrder, sortType, limit } = this.options
const { query, pageNumber } = get(this.store) const { query } = get(this.store)
// Get the actual data // Get the actual data
let { rows, info, hasNextPage, cursor } = await this.getData() let { rows, info, hasNextPage, cursor } = await this.getData()
@ -183,8 +183,7 @@ export default class DataFetch {
// If we don't support pagination, do a client-side limit // If we don't support pagination, do a client-side limit
if (!this.supportsPagination) { if (!this.supportsPagination) {
rows = rows.slice(pageNumber * limit, (pageNumber + 1) * limit) rows = luceneLimit(rows, limit)
// rows = luceneLimit(rows, limit)
} }
return { return {

7
packages/client/src/utils/fetch/ViewFetch.js

@ -2,16 +2,13 @@ import DataFetch from "./DataFetch.js"
import { fetchViewData } from "api" import { fetchViewData } from "api"
export default class ViewFetch extends DataFetch { export default class ViewFetch extends DataFetch {
static async getSchema(datasource, definition) { static getSchema(datasource, definition) {
const schema = definition?.views?.[datasource.name]?.schema return definition?.views?.[datasource.name]?.schema
console.log(schema)
return schema
} }
async getData() { async getData() {
const { datasource } = this.options const { datasource } = this.options
const res = await fetchViewData(datasource) const res = await fetchViewData(datasource)
console.log(res)
return { return {
rows: res || [], rows: res || [],
} }

Loading…
Cancel
Save