AOSSIE-Org / AOSSIE-Org/EduAid

[BUG][HIGH PRIORITY]: Output page crashes with Cannot read properties of undefined (reading forEach)

Offen
#610 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
JavaScript
Sterne
171
Forks
425
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Bug Description

The Output page crashes at runtime with:

`TypeError: Cannot read properties of undefined (reading 'forEach')`

This happens when stored payload keys are missing or malformed, and the page assumes arrays always exist before iterating.

Affected page:
- [eduaid_web/src/pages/Output.jsx](eduaid_web/src/pages/Output.jsx)

## Why this is high priority

- It breaks the core quiz result flow on the web UI.
- Users see a blank/error overlay instead of generated questions.
- It is reproducible and user-facing.

## Current behavior

The page calls `forEach` on values that may be undefined, such as:
- `output`
- `output_mcq.questions`
- `output_boolq.Boolean_Questions`

When any of these keys are absent, React crashes in the effect hook.

## Expected behavior

The Output page should:
1. Safely parse local storage data.
2. Treat missing arrays as empty arrays.
3. Render without crashing even if payload shape is partial.

### Steps to Reproduce

1. Generate questions with a payload shape that does not include all expected keys.
2. Open the Output page.
3. Observe runtime crash: `Cannot read properties of undefined (reading 'forEach')`.

### Environment Details

_No response_

### Impact

High - Major feature is broken

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.