diff options
author | 2022-06-23 15:05:31 +0400 | |
---|---|---|
committer | 2022-06-23 15:05:31 +0400 | |
commit | 7aa707daa1b4cfe9f2dedcc4e27d3b3a8600e79c (patch) | |
tree | bcae8de0d1d1f0488323b4e7d4cf2e1d19db7a5a /src/components/Question.tsx | |
parent | Merge pull request #453 from DavinderJolly/snekbox-results-feedback (diff) | |
parent | Bump Webpack Dev Server To 4.9.2 (diff) |
Merge pull request #454 from python-discord/bump-dependencies
Bump Dependencies
Diffstat (limited to 'src/components/Question.tsx')
-rw-r--r-- | src/components/Question.tsx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/components/Question.tsx b/src/components/Question.tsx index ebacb4a..61e66e0 100644 --- a/src/components/Question.tsx +++ b/src/components/Question.tsx @@ -35,14 +35,22 @@ class RenderedQuestion extends React.Component<QuestionProp> { } this.blurHandler = this.blurHandler.bind(this); - this.setPublicState("valid", true); - this.setPublicState("error", ""); + const _state: {[key: string]: string | boolean | null} = { + "valid": true, + "error": "", + }; + if (props.question.type === QuestionType.Code) { - this.setPublicState("unittestsFailed", false); + _state["unittestsFailed"] = false; } if (!skip_normal_state.includes(props.question.type)) { - this.setPublicState("value", ""); + _state["value"] = ""; + } + + this.state = _state; + for (const [key, value] of Object.entries(_state)) { + this.props.public_state.set(key, value); } } |