-
-
Notifications
You must be signed in to change notification settings - Fork 385
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.