Don't bother fetching data if no calculations defined
This commit is contained in:
parent
bf1bf1956a
commit
1cbae36683
|
@ -164,7 +164,6 @@ export const initialise = context => {
|
||||||
}
|
}
|
||||||
// Override a few properties for primary display
|
// Override a few properties for primary display
|
||||||
if (field === primaryDisplay) {
|
if (field === primaryDisplay) {
|
||||||
column.visible = true
|
|
||||||
column.order = 0
|
column.order = 0
|
||||||
column.primaryDisplay = true
|
column.primaryDisplay = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ViewV2Type } from "@budibase/types"
|
||||||
import DataFetch from "./DataFetch.js"
|
import DataFetch from "./DataFetch.js"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
|
|
||||||
|
@ -39,6 +40,19 @@ export default class ViewV2Fetch extends DataFetch {
|
||||||
this.options
|
this.options
|
||||||
const { cursor, query, definition } = get(this.store)
|
const { cursor, query, definition } = get(this.store)
|
||||||
|
|
||||||
|
// If this is a calculation view and we have no calculations, return nothing
|
||||||
|
if (
|
||||||
|
definition.type === ViewV2Type.CALCULATION &&
|
||||||
|
!Object.values(definition.schema || {}).some(x => x.calculationType)
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
rows: [],
|
||||||
|
hasNextPage: false,
|
||||||
|
cursor: null,
|
||||||
|
error: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If sort/filter params are not defined, update options to store the
|
// If sort/filter params are not defined, update options to store the
|
||||||
// params built in to this view. This ensures that we can accurately
|
// params built in to this view. This ensures that we can accurately
|
||||||
// compare old and new params and skip a redundant API call.
|
// compare old and new params and skip a redundant API call.
|
||||||
|
@ -67,6 +81,7 @@ export default class ViewV2Fetch extends DataFetch {
|
||||||
return {
|
return {
|
||||||
rows: [],
|
rows: [],
|
||||||
hasNextPage: false,
|
hasNextPage: false,
|
||||||
|
cursor: null,
|
||||||
error,
|
error,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue