mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 16:25:24 +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() {
|
export default function App() {
|
||||||
const [session, setSession] = useState<AuthSession | null>(() => getStoredSession());
|
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>({
|
const [appState, setAppState] = useState<AppState>({
|
||||||
headers: [],
|
headers: [],
|
||||||
data: [],
|
data: [],
|
||||||
@@ -53,6 +36,23 @@ export default function App() {
|
|||||||
const [pendingRows, setPendingRows] = useState<Record<string, { rowIndex: number; originalData: ExcelRow; newData: ExcelRow; articleName: string }>>({});
|
const [pendingRows, setPendingRows] = useState<Record<string, { rowIndex: number; originalData: ExcelRow; newData: ExcelRow; articleName: string }>>({});
|
||||||
const [isSavingAll, setIsSavingAll] = useState(false);
|
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(() => {
|
useEffect(() => {
|
||||||
const loadDefaultData = async () => {
|
const loadDefaultData = async () => {
|
||||||
// In dev: Vite proxy handles /dropbox-file (see vite.config.ts)
|
// In dev: Vite proxy handles /dropbox-file (see vite.config.ts)
|
||||||
|
|||||||
Reference in New Issue
Block a user