Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Merge qaPairs for 'all type' questions to avoid forEach error (#221) #222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ts-31
Copy link

@ts-31 ts-31 commented Feb 16, 2025

Summary:
This pull request fixes the "forEach" error that occurs when generating "all type" questions. The error was caused by the code trying to iterate over a non-existent "output" key in the qaPairs data from localStorage.

What Was Changed:

  • Modified the useEffect hook to explicitly merge data from the keys "output_boolq", "output_mcq", and "output_shortq" when the question type is "all type".
  • Added proper checks to ensure that each key exists and is an array before calling .forEach.

Testing:

  • Tested locally by generating questions with the "all type" option.
  • Verified that no error is thrown and that questions from all types are merged correctly.

Closes #221

@Aditya062003
Copy link
Contributor

Hey, I believe this issue is already being worked on!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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