-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EQM: On first save, update the quiz's ID when redirecting #12283
Changes from 2 commits
343522a
c24f038
8b83761
7f4614c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,7 +174,7 @@ | |
}, | ||
}); | ||
} else { | ||
if (this.$route.params.quizId === exam.id) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should remove this - but we should coerce them both to strings for the comparison because for draft exams the exam.id will be an integer, but the route parameter will be a string. When I did a subsequent save, not having this here led me to get a redundant navigation error from the replace below. |
||
if (String(this.$route.params.quizId) === String(exam.id)) { | ||
return; | ||
} | ||
this.$router.replace({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe be
if (!id || id !== exam.id) {
id
here being assigned to theget(_quiz).id
up above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably if
id
is undefined then it won't equalexam.id
either, so the falsy check might be redundant.But yeah, using the id that we already grabbed in the outer scope feels safer, just in case we're accidentally mutating state for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay cool - I was getting mixed up a bit around the use of
"new"
for the route until they save the quiz butget(_quiz).id
will always benull/undefined
here eh?