|
|
@@ -19,7 +19,7 @@ export default function FileList() {
|
|
|
const { addNotification } = useNotifications();
|
|
|
|
|
|
// Get available datasets
|
|
|
- const { data: datasets } = useQuery({
|
|
|
+ const { data: datasets, isLoading: isDatasetsLoading } = useQuery({
|
|
|
queryKey: ["datasets"],
|
|
|
queryFn: () => get(`/files/all-datasets`)
|
|
|
});
|
|
|
@@ -446,7 +446,10 @@ export default function FileList() {
|
|
|
|
|
|
const displayFiles = paginatedData;
|
|
|
|
|
|
- if (isLoading) return <LoadingCard message="Loading files..." />;
|
|
|
+ // Show loading state if datasets are loading, allFiles is loading, or data is undefined
|
|
|
+ if (isDatasetsLoading || isLoading || !allFiles) {
|
|
|
+ return <LoadingCard message="Loading files..." />;
|
|
|
+ }
|
|
|
if (error) {
|
|
|
return (
|
|
|
<div className="text-center p-8 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">
|