AOSSIE-Org / AOSSIE-Org/EduAid

Bug: "forEach" error for "all type" questions due to missing "output" key in qaPairs

Ouverte
#221 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
171
Forks
423
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Description:
When generating "all type" questions, the application throws a TypeError:
TypeError: Cannot read properties of undefined (reading 'forEach')

Steps to Reproduce:

Generate questions using the "all type" option.
Observe that the code attempts to iterate over qaPairsFromStorage["output"] using .forEach().
Expected Behavior:
For "all type" questions, the application should merge question data from the keys "output_boolq", "output_mcq", and "output_shortq" rather than expecting a non-existent "output" key.

Actual Behavior:
The code falls into a branch that calls .forEach() on qaPairsFromStorage["output"], which is undefined when the question type is "all type".

Proposed Fix:
Update the useEffect hook that reads qaPairs from localStorage to explicitly check for and merge data from the correct keys (i.e., "output_boolq", "output_mcq", and "output_shortq") when "all type" is selected.

Please let me know if you need further clarification.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.