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

Fixed use of setTimeout to avoid errors when dispatching custom actions #453

Merged
merged 1 commit into from Dec 22, 2016

Conversation

abrel
Copy link
Contributor

@abrel abrel commented Dec 22, 2016

The implementation of setTimeout in utils/events is incorrect and then leading to some errors when trying to use advanced handlers.

Passing a function to setTimeout solves this issue.

Below is an example of error with the current implementation:

Uncaught TypeError: callback.apply is not a function
at new_callback (http://localhost:8000/webpack:/~/longjohn/dist/longjohn.js:188:1)

at global.setTimeout (http://localhost:8000/webpack:/~/longjohn/dist/longjohn.js:289:1)
at http://localhost:8000/webpack:/~/smooch/lib/utils/events.js:69:1
at Set.forEach (native)
at Set.<anonymous> (http://localhost:8000/webpack:/~/core-js/library/modules/_collection.js:40:1)
at Observable.trigger (http://localhost:8000/webpack:/~/smooch/lib/utils/events.js:68:1)
at openWidget (http://localhost:8000/webpack:/~/smooch/lib/services/app-service.js:54:1)
at MessengerButtonComponent._this2.onClick (http://localhost:8000/webpack:/~/smooch/lib/components/messenger-button.js:101:1)
at Object.ReactErrorUtils.invokeGuardedCallback (http://localhost:8000/webpack:/~/react-dom/lib/ReactErrorUtils.js:70:1)
at executeDispatch (http://localhost:8000/webpack:/~/react-dom/lib/EventPluginUtils.js:85:1)
at Object.executeDispatchesInOrder (http://localhost:8000/webpack:/~/react-dom/lib/EventPluginUtils.js:108:1)
at executeDispatchesAndRelease (http://localhost:8000/webpack:/~/react-dom/lib/EventPluginHub.js:43:1)
at executeDispatchesAndReleaseTopLevel (http://localhost:8000/webpack:/~/react-dom/lib/EventPluginHub.js:54:1)
at Array.forEach (native)
at forEachAccumulated (http://localhost:8000/webpack:/~/react-dom/lib/forEachAccumulated.js:24:1)
at Object.processEventQueue (http://localhost:8000/webpack:/~/react-dom/lib/EventPluginHub.js:230:1)
at runEventQueueInBatch (http://localhost:8000/webpack:/~/react-dom/lib/ReactEventEmitterMixin.js:17:1)

@lemieux lemieux changed the title Fixed use of setTiemout to avoid errors when dispatching custom actions Fixed use of setTimeout to avoid errors when dispatching custom actions Dec 22, 2016
Copy link
Member

@lemieux lemieux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this and well done! This setTimeout was pretty much useless without a wrapping function. We'll merge and deploy it tomorrow.

@lemieux lemieux merged commit d24db9a into zendesk:integration Dec 22, 2016
@lemieux lemieux mentioned this pull request Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants