Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing frontend-core fetch apis #15295

Merged
merged 64 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
913cefa
Type index
adrinr Dec 31, 2024
ecfc248
Type datafetch
adrinr Dec 31, 2024
d7cfd51
Type tablefetch
adrinr Jan 2, 2025
89eba31
Use tempaltes
adrinr Jan 2, 2025
97eb4a2
Type view fetch
adrinr Jan 2, 2025
163ca34
Create apis
adrinr Jan 2, 2025
1899af9
More types
adrinr Jan 2, 2025
c725536
Cleanup
adrinr Jan 2, 2025
54d5047
Convert UserFetch
adrinr Jan 2, 2025
65fa3e0
Use APIClient
adrinr Jan 2, 2025
1f51489
Type views
adrinr Jan 2, 2025
f0d60c6
Fix user types
adrinr Jan 2, 2025
69ad15f
Fix types
adrinr Jan 2, 2025
b420fda
Convert ViewFetch
adrinr Jan 2, 2025
2b863cc
Fix imports
adrinr Jan 2, 2025
543660d
Convert fieldFetch
adrinr Jan 3, 2025
97b0883
Convert fieldFetch
adrinr Jan 3, 2025
550cdd7
Fix field selector on datasource picker
adrinr Jan 3, 2025
1d661c6
Fix sort issue (with broken ts)
adrinr Jan 3, 2025
af22eb3
Type relationship fetch
adrinr Jan 7, 2025
8d74833
Type groupUserFetch
adrinr Jan 7, 2025
c52dd56
Fix userFetch query
adrinr Jan 7, 2025
dedf2e5
Fix types
adrinr Jan 7, 2025
0eddc1a
Type QueryFetch
adrinr Jan 7, 2025
8c0e7a1
Remove anys
adrinr Jan 7, 2025
f4ed217
Fix types
adrinr Jan 7, 2025
89485aa
Extend types
adrinr Jan 7, 2025
364e997
Type jsonArrayFetch
adrinr Jan 7, 2025
690a442
convert QueryArrayFetch
adrinr Jan 7, 2025
f76ec8d
Fix types
adrinr Jan 7, 2025
91300c5
Type nestedProvider
adrinr Jan 7, 2025
bf02515
Fix types
adrinr Jan 7, 2025
30cf6ff
Type customFetch
adrinr Jan 7, 2025
090429f
Fix sort order enum type
adrinr Jan 7, 2025
dcf52b5
Fix typings
adrinr Jan 7, 2025
ed2e35d
Dry
adrinr Jan 7, 2025
a1ac0ac
Fix type
adrinr Jan 8, 2025
022df7c
Lint
adrinr Jan 8, 2025
d465f7e
Type anys
adrinr Jan 8, 2025
7d7c27f
Simplify determineFeatureFlags
adrinr Jan 8, 2025
f053438
Clean classes
adrinr Jan 8, 2025
5d63fe2
Simplify
adrinr Jan 8, 2025
3741b71
Clean code
adrinr Jan 8, 2025
265b22f
Type query
adrinr Jan 8, 2025
0112087
Improve typing
adrinr Jan 8, 2025
af0312e
Proper type QueryArrayFetch
adrinr Jan 8, 2025
fc4336a
Add typings
adrinr Jan 8, 2025
88760d4
Proper type nestedProvider
adrinr Jan 8, 2025
fae3c6b
Type GroupUserFetch
adrinr Jan 8, 2025
2fb243a
Fix customFetch
adrinr Jan 8, 2025
819ca21
Clean types
adrinr Jan 8, 2025
10fca94
Cleanups
adrinr Jan 8, 2025
95d3238
Fix declarations
adrinr Jan 8, 2025
83bc2e1
Fix types
adrinr Jan 8, 2025
d3ba4b1
Fix return type
adrinr Jan 8, 2025
5f82a39
Undo some typings
adrinr Jan 8, 2025
a8abe5b
Remove deprecated fetch
adrinr Jan 8, 2025
0ca0ba6
Type nulls
adrinr Jan 8, 2025
a414505
Cleanups
adrinr Jan 8, 2025
0784a95
Remove ! usage
adrinr Jan 8, 2025
3a8942f
Add todos
adrinr Jan 8, 2025
23f9e3f
Add todo
adrinr Jan 8, 2025
eb6a243
Simplify code
adrinr Jan 8, 2025
3832963
Merge branch 'master' into typing/fetch-apis
adrinr Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix types
  • Loading branch information
adrinr committed Jan 8, 2025
commit bf02515ff0c546440ce9a9c16e0f5e7cfe304459
7 changes: 4 additions & 3 deletions packages/frontend-core/src/components/grid/stores/rows.ts
Original file line number Diff line number Diff line change
@@ -10,17 +10,18 @@ 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
}

interface RowStore {
rows: Writable<UIRow[]>
fetch: Writable<UIFetchAPI | null>
fetch: Writable<DataFetch<any, any, any> | null>
adrinr marked this conversation as resolved.
Show resolved Hide resolved
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"
11 changes: 7 additions & 4 deletions packages/frontend-core/src/fetch/DataFetch.ts
Original file line number Diff line number Diff line change
@@ -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(),
}))
}