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
Fix error with grecaptcha2 #502
Conversation
HISTORY.markdown
Outdated
@@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |||
|
|||
## [Unreleased] | |||
|
|||
### Fixed | |||
|
|||
* Fixed issue [#500][github-issue-500] with grecaptcha2. See [#502][github-pr-502]. |
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.
I think in changelog we need to talk about Cannot read property 'type' of null
and messages, not about grecaptcha2. Cause this error can be in other cases too.
@@ -12,7 +12,7 @@ uploadcare.namespace 'utils', (ns) -> | |||
catch | |||
return | |||
|
|||
if message.type of callbacks | |||
if message? and message.type of callbacks |
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.
You can use the existential operator in this way -message?.type
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.
@Zmoki Did you mean to make use it like message.type? and message.type of callbacks
or message?.type of callbacks
.
Only the first one is right cause in the second case callbacks
will be iterated anyway.
507b154
to
b004188
Compare
HISTORY.markdown
Outdated
|
||
* Fixed error `Cannot read property 'type' of null` that often occurs together with the grecaptcha2. See [#502][github-pr-502]. |
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.
See issue instead of pr
@@ -12,7 +12,7 @@ uploadcare.namespace 'utils', (ns) -> | |||
catch | |||
return | |||
|
|||
if message.type of callbacks | |||
if message?.type and message.type of callbacks |
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.
message?.type and message.type
-> message?.type
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.
@Zmoki nope, because in this case callbacks
will be iterated anyway, i.e. will be searched for null (if there is no message or type in message)
c3ca1eb
to
cfb7808
Compare
cfb7808
to
a984d5a
Compare
Fix for #500
Demo: https://codepen.io/anon/pen/qMqpVo
PR for v2: #503