Skip to content

Commit

Permalink
fix: check backend data is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
swouf committed Jun 19, 2024
1 parent c2639d4 commit b46690d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/question-view/QuestionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ const QuestionView = (): JSX.Element => {

// Update the answer if the stored value change
useEffect(() => {
if (status === 'success' && answer.length === 0 && !isInit) {
if (
status === 'success' &&
answer.length === 0 &&
!isInit &&
typeof userAnswer !== 'undefined'
) {
setAnswer(userAnswer?.answer ?? '');
setIsInit(true);
}
Expand Down

0 comments on commit b46690d

Please sign in to comment.