Skip to content
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

Merged
merged 1 commit into from Sep 5, 2018
Merged

Fix error with grecaptcha2 #502

merged 1 commit into from Sep 5, 2018

Conversation

nd0ut
Copy link
Member

@nd0ut nd0ut commented Aug 30, 2018

Fix for #500
Demo: https://codepen.io/anon/pen/qMqpVo

PR for v2: #503

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].
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Member Author

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.

@nd0ut nd0ut force-pushed the fix/grecaptcha2-error branch 2 times, most recently from 507b154 to b004188 Compare September 3, 2018 15:18
HISTORY.markdown Outdated

* Fixed error `Cannot read property 'type' of null` that often occurs together with the grecaptcha2. See [#502][github-pr-502].
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Member Author

@nd0ut nd0ut Sep 4, 2018

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)

@nd0ut nd0ut merged commit 543ad74 into master Sep 5, 2018
@nd0ut nd0ut deleted the fix/grecaptcha2-error branch September 5, 2018 11:02
@nd0ut nd0ut restored the fix/grecaptcha2-error branch September 5, 2018 11:04
@nd0ut nd0ut deleted the fix/grecaptcha2-error branch September 5, 2018 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants