Explicitly fetch the data from fetch

This commit is contained in:
Adria Navarro 2025-01-09 15:58:59 +01:00
parent e4689e9cf5
commit a5ec510280
2 changed files with 6 additions and 4 deletions

View File

@ -179,9 +179,6 @@ export default abstract class DataFetch<
this.store.update($store => ({ ...$store, loaded: true })) this.store.update($store => ({ ...$store, loaded: true }))
return return
} }
// Initially fetch data but don't bother waiting for the result
this.getInitialData()
} }
/** /**

View File

@ -33,7 +33,12 @@ const DataFetchMap = {
export const fetchData = ({ API, datasource, options }: any) => { export const fetchData = ({ API, datasource, options }: any) => {
const Fetch = const Fetch =
DataFetchMap[datasource?.type as keyof typeof DataFetchMap] || TableFetch DataFetchMap[datasource?.type as keyof typeof DataFetchMap] || TableFetch
return new Fetch({ API, datasource, ...options }) const fetch = new Fetch({ API, datasource, ...options })
// Initially fetch data but don't bother waiting for the result
fetch.getInitialData()
return fetch
} }
// Creates an empty fetch instance with no datasource configured, so no data // Creates an empty fetch instance with no datasource configured, so no data