Fix types
This commit is contained in:
parent
0f069b77fc
commit
72d7443d72
|
@ -8,6 +8,7 @@ import {
|
|||
import { get } from "svelte/store"
|
||||
import { Store as StoreContext } from ".."
|
||||
import { DatasourceTableActions } from "."
|
||||
import { TableFetch } from "@budibase/frontend-core"
|
||||
|
||||
const SuppressErrors = true
|
||||
|
||||
|
@ -119,7 +120,7 @@ export const initialise = (context: StoreContext) => {
|
|||
unsubscribers.push(
|
||||
allFilters.subscribe($allFilters => {
|
||||
// Ensure we're updating the correct fetch
|
||||
const $fetch = get(fetch)
|
||||
const $fetch = get(fetch) as TableFetch | null
|
||||
if ($fetch?.options?.datasource?.tableId !== $datasource.tableId) {
|
||||
return
|
||||
}
|
||||
|
@ -133,7 +134,7 @@ export const initialise = (context: StoreContext) => {
|
|||
unsubscribers.push(
|
||||
sort.subscribe($sort => {
|
||||
// Ensure we're updating the correct fetch
|
||||
const $fetch = get(fetch)
|
||||
const $fetch = get(fetch) as TableFetch | null
|
||||
if ($fetch?.options?.datasource?.tableId !== $datasource.tableId) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import {
|
|||
SaveRowRequest,
|
||||
SortOrder,
|
||||
UIDatasource,
|
||||
UIView,
|
||||
UpdateViewRequest,
|
||||
} from "@budibase/types"
|
||||
import { Store as StoreContext } from ".."
|
||||
import { DatasourceViewActions } from "."
|
||||
import { ViewV2Fetch } from "@budibase/frontend-core"
|
||||
|
||||
const SuppressErrors = true
|
||||
|
||||
|
@ -134,6 +134,9 @@ export const initialise = (context: StoreContext) => {
|
|||
if (!get(config).canSaveSchema) {
|
||||
return
|
||||
}
|
||||
if (!$definition || !("id" in $definition)) {
|
||||
return
|
||||
}
|
||||
if ($definition?.id !== $datasource.id) {
|
||||
return
|
||||
}
|
||||
|
@ -184,7 +187,10 @@ export const initialise = (context: StoreContext) => {
|
|||
unsubscribers.push(
|
||||
sort.subscribe(async $sort => {
|
||||
// Ensure we're updating the correct view
|
||||
const $view = get(definition) as UIView
|
||||
const $view = get(definition)
|
||||
if (!$view || !("id" in $view)) {
|
||||
return
|
||||
}
|
||||
if ($view?.id !== $datasource.id) {
|
||||
return
|
||||
}
|
||||
|
@ -207,7 +213,7 @@ export const initialise = (context: StoreContext) => {
|
|||
|
||||
// Also update the fetch to ensure the new sort is respected.
|
||||
// Ensure we're updating the correct fetch.
|
||||
const $fetch = get(fetch)
|
||||
const $fetch = get(fetch) as ViewV2Fetch | null
|
||||
if ($fetch?.options?.datasource?.id !== $datasource.id) {
|
||||
return
|
||||
}
|
||||
|
@ -225,6 +231,9 @@ export const initialise = (context: StoreContext) => {
|
|||
return
|
||||
}
|
||||
const $view = get(definition)
|
||||
if (!$view || !("id" in $view)) {
|
||||
return
|
||||
}
|
||||
if ($view?.id !== $datasource.id) {
|
||||
return
|
||||
}
|
||||
|
@ -246,7 +255,7 @@ export const initialise = (context: StoreContext) => {
|
|||
if (!get(config).canSaveSchema) {
|
||||
return
|
||||
}
|
||||
const $fetch = get(fetch)
|
||||
const $fetch = get(fetch) as ViewV2Fetch | null
|
||||
if ($fetch?.options?.datasource?.id !== $datasource.id) {
|
||||
return
|
||||
}
|
||||
|
@ -262,7 +271,7 @@ export const initialise = (context: StoreContext) => {
|
|||
if (get(config).canSaveSchema) {
|
||||
return
|
||||
}
|
||||
const $fetch = get(fetch)
|
||||
const $fetch = get(fetch) as ViewV2Fetch | null
|
||||
if ($fetch?.options?.datasource?.id !== $datasource.id) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@ import { APIClient } from "../api/types"
|
|||
import { Table, ViewV2Enriched } from "@budibase/types"
|
||||
|
||||
export type DataFetchType = keyof typeof DataFetchMap
|
||||
|
||||
export type { default as TableFetch } from "./TableFetch"
|
||||
export type { default as ViewFetch } from "./ViewFetch"
|
||||
export type { default as ViewV2Fetch } from "./ViewV2Fetch"
|
||||
|
||||
export type { DataFetchOptions } from "./DataFetch"
|
||||
export type { UserDatasource } from "./UserFetch"
|
||||
export type { GroupUserDatasource } from "./GroupUserFetch"
|
||||
|
@ -86,6 +91,8 @@ export type DataFetchDefinition =
|
|||
| {
|
||||
schema?: Record<string, any> | null
|
||||
primaryDisplay?: string
|
||||
rowHeight?: number
|
||||
type?: string
|
||||
}
|
||||
|
||||
// Constructs a new fetch model for a certain datasource
|
||||
|
|
|
@ -3,6 +3,9 @@ export type { APIClient } from "./api"
|
|||
export { fetchData, DataFetchMap } from "./fetch"
|
||||
export type {
|
||||
DataFetchType,
|
||||
TableFetch,
|
||||
ViewFetch,
|
||||
ViewV2Fetch,
|
||||
DataFetchOptions,
|
||||
DataFetchDatasource,
|
||||
UserDatasource,
|
||||
|
|
Loading…
Reference in New Issue