mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 12:35:25 +02:00
Fix React hooks order - all useState at top
This commit is contained in:
+17
-17
@@ -19,23 +19,6 @@ import { PendingValidationView } from './components/PendingValidationView';
|
||||
export default function App() {
|
||||
const [session, setSession] = useState<AuthSession | null>(() => getStoredSession());
|
||||
|
||||
useEffect(() => {
|
||||
console.log('[App] session changed:', session ? 'logged in' : 'logged out');
|
||||
}, [session]);
|
||||
|
||||
const handleSignOut = () => {
|
||||
signOut();
|
||||
setSession(null);
|
||||
};
|
||||
|
||||
if (!session) {
|
||||
return <LoginPage onLogin={() => {
|
||||
const stored = getStoredSession();
|
||||
console.log('[App] onLogin, stored session:', stored ? 'found' : 'null');
|
||||
setSession(stored);
|
||||
}} />;
|
||||
}
|
||||
|
||||
const [appState, setAppState] = useState<AppState>({
|
||||
headers: [],
|
||||
data: [],
|
||||
@@ -53,6 +36,23 @@ export default function App() {
|
||||
const [pendingRows, setPendingRows] = useState<Record<string, { rowIndex: number; originalData: ExcelRow; newData: ExcelRow; articleName: string }>>({});
|
||||
const [isSavingAll, setIsSavingAll] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('[App] session changed:', session ? 'logged in' : 'logged out');
|
||||
}, [session]);
|
||||
|
||||
const handleSignOut = () => {
|
||||
signOut();
|
||||
setSession(null);
|
||||
};
|
||||
|
||||
if (!session) {
|
||||
return <LoginPage onLogin={() => {
|
||||
const stored = getStoredSession();
|
||||
console.log('[App] onLogin, stored session:', stored ? 'found' : 'null');
|
||||
setSession(stored);
|
||||
}} />;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const loadDefaultData = async () => {
|
||||
// In dev: Vite proxy handles /dropbox-file (see vite.config.ts)
|
||||
|
||||
Reference in New Issue
Block a user