From 442f8d3fbd0cbc200900643e3ba882159a8dcb67 Mon Sep 17 00:00:00 2001
From: DavinderJolly <34959171+DavinderJolly@users.noreply.github.com>
Date: Sat, 18 Jun 2022 03:50:49 +0530
Subject: Fix rendering error message for failed unit tests.

fix rendering of error message by updating public_state prop before updating state, and only catch 422 status code in FormPage
---
 src/components/Question.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/Question.tsx')

diff --git a/src/components/Question.tsx b/src/components/Question.tsx
index 3b63f07..ebacb4a 100644
--- a/src/components/Question.tsx
+++ b/src/components/Question.tsx
@@ -47,8 +47,8 @@ class RenderedQuestion extends React.Component<QuestionProp> {
     }
 
     setPublicState(target: string, value: string | boolean | null, callback?:() => void): void {
-        this.setState({[target]: value}, callback);
         this.props.public_state.set(target, value);
+        this.setState({[target]: value}, callback);
     }
 
     // This is here to allow dynamic selection between the general handler, textarea, and code field handlers.
-- 
cgit v1.2.3

