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
feat(viewer): integrate file upload component in form logic (DSP-1257) #264
Conversation
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.
Good job! Thanks.
}, { updateOn: 'blur' }); | ||
|
||
if (this.parentForm !== undefined) { |
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.
Is this in purpose just for undefined? Otherwise it can be simplified to if (this.parentForm) {}
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.
Of course if (this.parentForm) {}
would also work.
However, this involves a conversion of undefined
to a Boolean value.
this.parentForm !== undefined
checks that the member this.parentForm
has been initialised, not performing any type conversion.
So all it does is checking exactly for undefined
which is a special type in JS.
if (myvar) {}
could give unexpected results if myvar
was actually a Boolean. So if mayvar
was initialised to false
, this would not be the same as undefined
.
The condition should prevent errors in case of non initialised vars.
So in general, I am trying to avoid implicit type conversions.
resolves DSP-1257