Skip to content

Commit 3d2a8b8

Browse files
committed
guard against undefined step_completions from failed session
makeRequest returns {} when session token is missing (503 from /api/auth/session). The truthy {} passed the if-check and set stepCompletions to undefined, crashing on next render.
1 parent a64ec3c commit 3d2a8b8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

hooks/useActivityProgress.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function useActivityProgress({ slug, assignmentId, initialStep = 1, email
109109
logger.logEvent(operation, data);
110110

111111
// Update local state with server response
112-
if (updatedProgress) {
112+
if (updatedProgress?.step_completions) {
113113
setStepCompletions(updatedProgress.step_completions);
114114
setActivityLogs(updatedProgress.activity_logs || []);
115115
}

0 commit comments

Comments
 (0)