From b60250e265f53d3ed4ac4424e3cd59d0909318a8 Mon Sep 17 00:00:00 2001 From: Manus Sandbox Date: Wed, 12 Nov 2025 10:10:31 -0500 Subject: [PATCH] =?UTF-8?q?Checkpoint:=20Correction=20de=20l'erreur=20Reac?= =?UTF-8?q?t=20"Cannot=20update=20a=20component=20while=20rendering"=20dan?= =?UTF-8?q?s=20Home.tsx.=20L'appel=20de=20setLocation=20pour=20la=20redire?= =?UTF-8?q?ction=20automatique=20des=20admins=20a=20=C3=A9t=C3=A9=20d?= =?UTF-8?q?=C3=A9plac=C3=A9=20dans=20un=20useEffect=20pour=20respecter=20l?= =?UTF-8?q?es=20r=C3=A8gles=20de=20React=20et=20=C3=A9viter=20les=20mises?= =?UTF-8?q?=20=C3=A0=20jour=20de=20composants=20pendant=20le=20rendu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/Home.tsx | 8 +++++++- todo.md | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx index aba88e1..557f4f8 100644 --- a/client/src/pages/Home.tsx +++ b/client/src/pages/Home.tsx @@ -4,11 +4,18 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/com import { APP_LOGO, APP_TITLE, getLoginUrl } from "@/const"; import { GraduationCap, Calendar, Users, CheckCircle, Mail, Download } from "lucide-react"; import { useLocation } from "wouter"; +import { useEffect } from "react"; export default function Home() { const { user, loading, isAuthenticated } = useAuth(); const [, setLocation] = useLocation(); + useEffect(() => { + if (!loading && isAuthenticated && user?.role === 'admin') { + setLocation('/admin'); + } + }, [loading, isAuthenticated, user?.role, setLocation]); + if (loading) { return (
@@ -18,7 +25,6 @@ export default function Home() { } if (isAuthenticated && user?.role === 'admin') { - setLocation('/admin'); return null; } diff --git a/todo.md b/todo.md index 7d1d6c9..e6ff13f 100644 --- a/todo.md +++ b/todo.md @@ -96,3 +96,7 @@ - [x] Adapter les emails pour inclure toutes les dates de la séquence - [x] Mettre à jour les invitations Outlook pour créer 4 événements si nécessaire - [x] Renommer partout dans l'interface utilisateur (labels, titres, descriptions) + +## Corrections urgentes + +- [x] Corriger l'erreur React "Cannot update a component while rendering" dans Home.tsx