diff --git a/packages/frontend-core/src/fetch/DataFetch.ts b/packages/frontend-core/src/fetch/DataFetch.ts index 9312c57637..0079fec057 100644 --- a/packages/frontend-core/src/fetch/DataFetch.ts +++ b/packages/frontend-core/src/fetch/DataFetch.ts @@ -179,9 +179,6 @@ export default abstract class DataFetch< this.store.update($store => ({ ...$store, loaded: true })) return } - - // Initially fetch data but don't bother waiting for the result - this.getInitialData() } /** diff --git a/packages/frontend-core/src/fetch/index.ts b/packages/frontend-core/src/fetch/index.ts index 4accb0b5ec..c1f35abef2 100644 --- a/packages/frontend-core/src/fetch/index.ts +++ b/packages/frontend-core/src/fetch/index.ts @@ -33,7 +33,12 @@ const DataFetchMap = { export const fetchData = ({ API, datasource, options }: any) => { const Fetch = 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