We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4a8c321 + 324733b commit e12e894Copy full SHA for e12e894
1 file changed
src/pages/Dashboard.tsx
@@ -233,10 +233,15 @@ const Dashboard = () => {
233
const fetchSessions = async () => {
234
// SECURITY/PERF: Limit fetch to top 4 to prevent downloading 10,000 global sessions
235
// which would cause massive browser OOM crashes and render thrashing.
236
+ if (!user?.id) {
237
+ setUpcomingSessions([]);
238
+ return;
239
+ }
240
const { data, error } = await supabase
241
.from("sessions")
242
.select("*")
243
.eq("status", "upcoming")
244
+ .or(`mentor_id.eq.${user.id},student_id.eq.${user.id}`)
245
.limit(4);
246
247
if (error || !data) {
@@ -248,7 +253,7 @@ const Dashboard = () => {
248
253
};
249
254
250
255
fetchSessions();
251
- }, []);
256
+ }, [user?.id]);
252
257
258
const [globalRank, setGlobalRank] = useState<number>(0);
259
0 commit comments