fix: FullContextRoutes no longer blocks on Neo4j contexts
Removed NeoUserContext and NeoInstituteContext from the gateway spinner. They were blocking ALL authenticated routes until Neo4j graph data was loaded, which took 1-8 seconds and caused persistent spinners. Now only UserContext (Supabase profile, ~200ms) must be ready before routes render. Each page handles its own graph data loading state independently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
679653c118
commit
3c0fd4f647
@ -2,8 +2,6 @@ import React from 'react';
|
|||||||
import { Routes, Route, useLocation, Outlet, Navigate } from 'react-router-dom';
|
import { Routes, Route, useLocation, Outlet, Navigate } from 'react-router-dom';
|
||||||
import { useAuth } from './contexts/AuthContext';
|
import { useAuth } from './contexts/AuthContext';
|
||||||
import { useUser } from './contexts/UserContext';
|
import { useUser } from './contexts/UserContext';
|
||||||
import { useNeoUser } from './contexts/NeoUserContext';
|
|
||||||
import { useNeoInstitute } from './contexts/NeoInstituteContext';
|
|
||||||
import Layout from './pages/Layout';
|
import Layout from './pages/Layout';
|
||||||
import LoginPage from './pages/auth/loginPage';
|
import LoginPage from './pages/auth/loginPage';
|
||||||
import SignupPage from './pages/auth/signupPage';
|
import SignupPage from './pages/auth/signupPage';
|
||||||
@ -38,18 +36,11 @@ import {
|
|||||||
} from './pages/timetable';
|
} from './pages/timetable';
|
||||||
|
|
||||||
const FullContextRoutes: React.FC = () => {
|
const FullContextRoutes: React.FC = () => {
|
||||||
|
// Only block on Supabase profile being ready — Neo4j contexts initialize in the background.
|
||||||
|
// Individual pages handle their own Neo4j loading states.
|
||||||
const { isInitialized: isUserInitialized } = useUser();
|
const { isInitialized: isUserInitialized } = useUser();
|
||||||
const { isLoading: isNeoUserLoading, isInitialized: isNeoUserInitialized } = useNeoUser();
|
|
||||||
const { isLoading: isNeoInstituteLoading, isInitialized: isNeoInstituteInitialized } = useNeoInstitute();
|
|
||||||
|
|
||||||
const isLoading =
|
if (!isUserInitialized) {
|
||||||
!isUserInitialized ||
|
|
||||||
isNeoUserLoading ||
|
|
||||||
!isNeoUserInitialized ||
|
|
||||||
isNeoInstituteLoading ||
|
|
||||||
!isNeoInstituteInitialized;
|
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user