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: this.queue.push is not a function #61

Closed
pahund opened this issue May 18, 2021 · 2 comments · Fixed by #62
Closed

fix: this.queue.push is not a function #61

pahund opened this issue May 18, 2021 · 2 comments · Fixed by #62
Labels
fix Patches a bug in the codebase

Comments

@pahund
Copy link

pahund commented May 18, 2021

In eBay's Track.js error tracking system for Kijiji Autos, we see reports like this:

this.queue.push is not a function. (In 'this.queue.push({id:t,customEventHandlers:r})', 'this.queue.push' is undefined)

These are errors happening in production, in our users' browsers.

Version 4.0.0.beta has improved the situation, so that the errors happen less frequently:

less-frequent-with-4-beta

Stack trace:

image

The likely culprit is the de-initialization that happens when the AdvertisingProvider unmounts.

@pahund pahund added the fix Patches a bug in the codebase label May 18, 2021
@filipecosta01
Copy link
Collaborator

filipecosta01 commented May 19, 2021

@pahund I was going through the code and I spotted that the queue is being set to an object instead of an array in the unmount function of lifecycle. It could explain that during the unmount we still have some calls to activate and as the queue is now an object, we don't have the push function
.

https://github.com/eBayClassifiedsGroup/react-advertising/blob/3b62c84dc9c192dd7d8c5fc74df237dde2701941/src/Advertising.js#L94

I can open a PR to fix that, though I'm not sure how to replicate it consistently.
Do you have an alternative way to test?

@pahund
Copy link
Author

pahund commented May 19, 2021

@filipecosta01

@pahund I was going through the code and I spotted that the queue is being set to an object instead of an array in the unmount function of lifecycle.
I can open a PR to fix that, though I'm not sure how to replicate it consistently.

That's a great catch, please do open a PR!

Do you have an alternative way to test?

Not yet. We could set up a Storybook story where we set up and tear down at the click of a button, then write a Cypress test. But for now, it will suffice if you change these blatantly wrong curly braces into square brackets.

filipecosta01 added a commit that referenced this issue May 19, 2021
Advertising queue is constructed as an array but when unmounting it is set to an object.
Fixes #61 (comment)
@pahund pahund linked a pull request May 19, 2021 that will close this issue
pahund pushed a commit that referenced this issue May 19, 2021
Advertising queue is constructed as an array but when unmounting it is set to an object.
Fixes #61 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Patches a bug in the codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants