|
@@ -1,6 +1,6 @@
|
|
|
"use client";
|
|
"use client";
|
|
|
|
|
|
|
|
-import { useState, useEffect } from 'react';
|
|
|
|
|
|
|
+import { useState, useEffect, useCallback } from 'react';
|
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
|
import { Button } from '@/components/ui/button';
|
|
import { Button } from '@/components/ui/button';
|
|
|
import { Upload, FileText, Database, BarChart3, CheckCircle, Loader2, History, PlusCircle } from 'lucide-react';
|
|
import { Upload, FileText, Database, BarChart3, CheckCircle, Loader2, History, PlusCircle } from 'lucide-react';
|
|
@@ -57,13 +57,7 @@ export default function CintasCalendarSummaryPage() {
|
|
|
const [selectedImport, setSelectedImport] = useState<ImportRecord | null>(null);
|
|
const [selectedImport, setSelectedImport] = useState<ImportRecord | null>(null);
|
|
|
const [loadingImports, setLoadingImports] = useState(true);
|
|
const [loadingImports, setLoadingImports] = useState(true);
|
|
|
|
|
|
|
|
- useEffect(() => {
|
|
|
|
|
- if (user) {
|
|
|
|
|
- loadPriorImports();
|
|
|
|
|
- }
|
|
|
|
|
- }, [user]);
|
|
|
|
|
-
|
|
|
|
|
- const loadPriorImports = async () => {
|
|
|
|
|
|
|
+ const loadPriorImports = useCallback(async () => {
|
|
|
try {
|
|
try {
|
|
|
setLoadingImports(true);
|
|
setLoadingImports(true);
|
|
|
setError(null); // Clear any previous errors
|
|
setError(null); // Clear any previous errors
|
|
@@ -98,7 +92,13 @@ export default function CintasCalendarSummaryPage() {
|
|
|
} finally {
|
|
} finally {
|
|
|
setLoadingImports(false);
|
|
setLoadingImports(false);
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ }, [user]);
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (user) {
|
|
|
|
|
+ loadPriorImports();
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [loadPriorImports, user]);
|
|
|
|
|
|
|
|
const handleFileUploaded = (file: FileData) => {
|
|
const handleFileUploaded = (file: FileData) => {
|
|
|
setUploadedFile(file);
|
|
setUploadedFile(file);
|