Skip to content

Commit e184ebf

Browse files
committed
make sure errors are still shown
Previously, the synchronous operations after firing the requests would finish before the requests were actually sent. This meant it was okay to enable error reporting after triggering the request. Now that we wait for the requests to finish, it's important to enable error reporting before firing the requests. It doesn't really matter whether we reset the feedback field before or after the requests were sent, as the box only appears after the last request finishes, but it's still safer to do before sending the requests.
1 parent e80d013 commit e184ebf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/app/components/content/IsaacInlineRegion.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export const useInlineRegionPart = (pageQuestions: AppQuestionDTO[] | undefined)
8787
export const submitInlineRegion = async (inlineContext: ContextType<typeof InlineContext>, currentGameboard: GameboardDTO | undefined, currentUser: any, pageQuestions: AppQuestionDTO[] | undefined, dispatch: any, hidingAttempts : boolean) => {
8888
if (inlineContext && inlineContext.docId && pageQuestions) {
8989
inlineContext.setSubmitting(true);
90+
inlineContext.canShowWarningToast = true;
91+
if (Object.keys(inlineContext.elementToQuestionMap).length > 1) inlineContext.setFeedbackIndex(0);
92+
9093
const inlineQuestions = pageQuestions.filter(q => inlineContext.docId && q.id?.startsWith(inlineContext.docId) && q.id.includes("|inline-question:"));
9194
// we submit all modified answers, and those with undefined values. we must submit this latter group to get a validation response at the same time as the other answers
9295
const modifiedInlineQuestions = inlineQuestions.filter(q => (q.id && inlineContext.modifiedQuestionIds.includes(q.id)) || (q.currentAttempt?.value === undefined && (q.bestAttempt === undefined || hidingAttempts)));
@@ -96,8 +99,6 @@ export const submitInlineRegion = async (inlineContext: ContextType<typeof Inlin
9699
inlineQuestion.id as string, inlineQuestion.type as string, currentGameboard, currentUser, dispatch, inlineContext
97100
);
98101
}
99-
inlineContext.canShowWarningToast = true;
100-
if (Object.keys(inlineContext.elementToQuestionMap).length > 1) inlineContext.setFeedbackIndex(0);
101102
}
102103
};
103104

0 commit comments

Comments
 (0)