Skip to content

Commit

Permalink
[front] Fixed loading state (#9553)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier authored Dec 19, 2024
1 parent 97902e7 commit 74f256f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions front/lib/swr/datasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ export function useDataset(
showData = false
) {
const datasetFetcher: Fetcher<GetDatasetResponseBody> = 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,
};
Expand Down

0 comments on commit 74f256f

Please sign in to comment.