Cleanups
This commit is contained in:
parent
2ad7e73813
commit
cf4ce587c4
|
@ -44,17 +44,14 @@ interface DataFetchDerivedStore<TDefinition, TQuery>
|
||||||
supportsPagination: boolean
|
supportsPagination: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DataFetchParams<
|
export interface DataFetchParams<TDatasource, TQuery = SearchFilters> {
|
||||||
TDatasource,
|
|
||||||
TQuery = SearchFilters | undefined
|
|
||||||
> {
|
|
||||||
API: APIClient
|
API: APIClient
|
||||||
datasource: TDatasource
|
datasource: TDatasource
|
||||||
query: TQuery
|
query: TQuery
|
||||||
options?: Partial<DataFetchOptions<TQuery>>
|
options?: Partial<DataFetchOptions<TQuery>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DataFetchOptions<TQuery = SearchFilters | undefined> {
|
export interface DataFetchOptions<TQuery = SearchFilters> {
|
||||||
// Search config
|
// Search config
|
||||||
filter: UISearchFilter | LegacyFilter[] | null
|
filter: UISearchFilter | LegacyFilter[] | null
|
||||||
query: TQuery
|
query: TQuery
|
||||||
|
@ -272,6 +269,7 @@ export default abstract class BaseDataFetch<
|
||||||
|
|
||||||
// Build the query
|
// Build the query
|
||||||
let query = this.options.query
|
let query = this.options.query
|
||||||
|
|
||||||
if (!query) {
|
if (!query) {
|
||||||
query = buildQuery(filter ?? undefined) as TQuery
|
query = buildQuery(filter ?? undefined) as TQuery
|
||||||
}
|
}
|
||||||
|
@ -435,7 +433,7 @@ export default abstract class BaseDataFetch<
|
||||||
* Resets the data set and updates options
|
* Resets the data set and updates options
|
||||||
* @param newOptions any new options
|
* @param newOptions any new options
|
||||||
*/
|
*/
|
||||||
async update(newOptions: Partial<DataFetchOptions<never>>) {
|
async update(newOptions: Partial<DataFetchOptions<TQuery>>) {
|
||||||
// Check if any settings have actually changed
|
// Check if any settings have actually changed
|
||||||
let refresh = false
|
let refresh = false
|
||||||
for (const [key, value] of Object.entries(newOptions || {})) {
|
for (const [key, value] of Object.entries(newOptions || {})) {
|
||||||
|
|
Loading…
Reference in New Issue