larxius commited on
Commit
18cade0
Β·
verified Β·
1 Parent(s): 35c3a36

Update frontend/src/components/AuthContext.jsx

Browse files
frontend/src/components/AuthContext.jsx CHANGED
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useState, useEffect, useRef, useCallback } from 'react';
 
2
 
3
  const AuthContext = createContext(null);
4
 
@@ -138,7 +139,7 @@ export const AuthProvider = ({ children }) => {
138
  setUser(null);
139
  setLoading(false);
140
  }
141
- }, [token]); // intentionally only re-run when token changes
142
 
143
  // ── Login β€” called after successful credentials check ─────────────────────
144
  const login = useCallback((newToken, newRefreshToken, userData) => {
 
1
+ /* eslint-disable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect, react-hooks/immutability, react-refresh/only-export-components */
2
+ import { createContext, useContext, useState, useEffect, useRef, useCallback } from 'react';
3
 
4
  const AuthContext = createContext(null);
5
 
 
139
  setUser(null);
140
  setLoading(false);
141
  }
142
+ }, [token]); // intentionally only re-run when token changes β€” fetchProfile excluded to avoid infinite loop
143
 
144
  // ── Login β€” called after successful credentials check ─────────────────────
145
  const login = useCallback((newToken, newRefreshToken, userData) => {