Fix types

This commit is contained in:
Adria Navarro 2025-01-07 13:42:51 +01:00
parent 91300c54e9
commit bf02515ff0
2 changed files with 11 additions and 7 deletions

View File

@ -10,9 +10,10 @@ import {
import { tick } from "svelte"
import { Helpers } from "@budibase/bbui"
import { sleep } from "../../../utils/utils"
import { FieldType, Row, UIFetchAPI, UIRow } from "@budibase/types"
import { FieldType, Row, UIRow } from "@budibase/types"
import { getRelatedTableValues } from "../../../utils"
import { Store as StoreContext } from "."
import DataFetch from "../../../fetch/DataFetch"
interface IndexedUIRow extends UIRow {
__idx: number
@ -20,7 +21,7 @@ interface IndexedUIRow extends UIRow {
interface RowStore {
rows: Writable<UIRow[]>
fetch: Writable<UIFetchAPI | null>
fetch: Writable<DataFetch<any, any, any> | null>
loaded: Writable<boolean>
refreshing: Writable<boolean>
loading: Writable<boolean>
@ -225,7 +226,7 @@ export const createActions = (context: StoreContext): RowActionStore => {
})
// Subscribe to changes of this fetch model
unsubscribe = newFetch.subscribe(async ($fetch: UIFetchAPI) => {
unsubscribe = newFetch.subscribe(async $fetch => {
if ($fetch.error) {
// Present a helpful error to the user
let message = "An unknown error occurred"

View File

@ -26,8 +26,11 @@ interface DataFetchStore<TDefinition, TQuery> {
pageNumber: number
cursor: null
cursors: any[]
resetKey: number
error: null
resetKey: string
error: {
message: string
status: number
} | null
definition?: TDefinition | null
}
@ -132,7 +135,7 @@ export default abstract class DataFetch<
pageNumber: 0,
cursor: null,
cursors: [],
resetKey: Math.random(),
resetKey: Math.random().toString(),
error: null,
})
@ -284,7 +287,7 @@ export default abstract class DataFetch<
info: page.info,
cursors: paginate && page.hasNextPage ? [null, page.cursor] : [null],
error: page.error,
resetKey: Math.random(),
resetKey: Math.random().toString(),
}))
}