fix bug where url draft attempt crashes

When a user saves a draft URL on the third attempt and then attempts to
navigate to the first attempt the page would crash.

Test Plan:
- Create a course and add a student to it
- Create an assignment with an online url submission type
- As the student navigate to the assignment and create and submit 2
  drafts
- Create a third draft and then attempt to navigate to the first draft
- Note that the page no longer crashes

fixes KNO-145
flag=assignments_2_student

Change-Id: I1c75d4e08d43f0f282c4fec5329b08f97d09ce4e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/217913
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Product-Review: Matthew Lemon <mlemon@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
This commit is contained in:
Matthew Lemon 2019-11-19 15:58:16 -07:00
parent ba7f83d080
commit e320e69e65
1 changed files with 2 additions and 1 deletions

View File

@ -46,7 +46,8 @@ class UrlEntry extends React.Component {
componentDidUpdate(prevProps) {
if (
this.props.submission?.submissionDraft?.url !== prevProps.submission?.submissionDraft?.url
this.props.submission?.submissionDraft?.url &&
this.props.submission.submissionDraft.url !== prevProps.submission?.submissionDraft?.url
) {
this.updateInputState()
}