diff --git a/front/lib/swr/datasets.ts b/front/lib/swr/datasets.ts index f9ca43b32804..45f37fb5870a 100644 --- a/front/lib/swr/datasets.ts +++ b/front/lib/swr/datasets.ts @@ -39,18 +39,18 @@ export function useDataset( showData = false ) { const datasetFetcher: Fetcher = fetcher; - + const disabled = !dataset; const { data, error, mutate } = useSWRWithDefaults( `/api/w/${owner.sId}/spaces/${app.space.sId}/apps/${app.sId}/datasets/${dataset}${ showData ? "?data=true" : "" }`, datasetFetcher, - { disabled: !dataset } + { disabled } ); return { dataset: data ? data.dataset : null, - isDatasetLoading: !error && !data, + isDatasetLoading: !error && !data && !disabled, isDatasetError: !!error, mutateDataset: mutate, };