Skip to content

Commit

Permalink
Merge pull request #350 from nicholasdalhaug/fix-severity-reset
Browse files Browse the repository at this point in the history
Fix severity reset on markdown change
  • Loading branch information
nicholasdalhaug authored Jan 26, 2021
2 parents 64bc988 + f5c4199 commit 8a1505f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface QuestionAndAnswerFormProps {
question: Question
answer: Answer
disabled: boolean
onAnswerChange: (answer: Answer) => void
onAnswerChange: (answerParts: Partial<Answer>) => void
savingState: SavingState
}

Expand Down Expand Up @@ -51,7 +51,7 @@ const QuestionAndAnswerForm = ({ questionNumber, question, answer, disabled, onA
<Box mr={5}>
<AnswerSeverityForm
severity={answer.severity}
onSeveritySelected={severity => onAnswerChange({ ...answer, severity: severity })}
onSeveritySelected={severity => onAnswerChange({ severity: severity })}
disabled={disabled}
/>
</Box>
Expand All @@ -60,7 +60,7 @@ const QuestionAndAnswerForm = ({ questionNumber, question, answer, disabled, onA
markdown={answer.text}
disabled={disabled}
onMarkdownChange={text => {
onAnswerChange({ ...answer, text: text })
onAnswerChange({ text: text })
}}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ const QuestionAndAnswerFormWithApi = ({
questionNumber={questionNumber}
question={question}
answer={localAnswer}
onAnswerChange={answer => {
onAnswerChange={answerParts => {
setSavingState(SavingState.Saving)
setLocalAnswer(answer)
setLocalAnswer(oldLocalAnswer => ({...oldLocalAnswer, ...answerParts}))
}}
disabled={disabled}
savingState={savingState}
Expand Down

0 comments on commit 8a1505f

Please sign in to comment.