diff --git a/components/questionCard.js b/components/questionCard.js index f4c3747..a312c50 100644 --- a/components/questionCard.js +++ b/components/questionCard.js @@ -191,7 +191,8 @@ const QuestionCard = ({ } const addOption = () => { - handleChange(id, 'options', [...question.options, '']) + const currentOptions = question.options || [] + handleChange(id, 'options', [...currentOptions, '']) } const removeOption = index => { diff --git a/pages/hackerapps/[id]/basicinfo.js b/pages/hackerapps/[id]/basicinfo.js index b25667e..42bae61 100644 --- a/pages/hackerapps/[id]/basicinfo.js +++ b/pages/hackerapps/[id]/basicinfo.js @@ -74,7 +74,9 @@ export default ({ id, hackathons }) => { useEffect(() => { const fetchQuestions = async () => { const appQuestions = await getHackerAppQuestions(id, 'BasicInfo') - setQuestions(appQuestions) + if (appQuestions?.length > 0) { + setQuestions(appQuestions) + } } const fetchMetadata = async () => { const fetchedMetadata = await getHackerAppQuestionsMetadata(id, 'BasicInfo') diff --git a/pages/hackerapps/[id]/questionnaire.js b/pages/hackerapps/[id]/questionnaire.js index b9f4e6f..52eaa3e 100644 --- a/pages/hackerapps/[id]/questionnaire.js +++ b/pages/hackerapps/[id]/questionnaire.js @@ -74,7 +74,9 @@ export default ({ id, hackathons }) => { useEffect(() => { const fetchQuestions = async () => { const appQuestions = await getHackerAppQuestions(id, 'Questionnaire') - setQuestions(appQuestions) + if (appQuestions?.length > 0) { + setQuestions(appQuestions) + } } const fetchMetadata = async () => { const fetchedMetadata = await getHackerAppQuestionsMetadata(id, 'Questionnaire') diff --git a/pages/hackerapps/[id]/skills.js b/pages/hackerapps/[id]/skills.js index ea4c4d9..f6eee93 100644 --- a/pages/hackerapps/[id]/skills.js +++ b/pages/hackerapps/[id]/skills.js @@ -74,7 +74,9 @@ export default ({ id, hackathons }) => { useEffect(() => { const fetchQuestions = async () => { const appQuestions = await getHackerAppQuestions(id, 'Skills') - setQuestions(appQuestions) + if (appQuestions?.length > 0) { + setQuestions(appQuestions) + } } const fetchMetadata = async () => { const fetchedMetadata = await getHackerAppQuestionsMetadata(id, 'Skills')