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

[1.0] Fix onRouteUpdate API #1102

Merged
merged 1 commit into from
Jun 5, 2017
Merged

[1.0] Fix onRouteUpdate API #1102

merged 1 commit into from
Jun 5, 2017

Conversation

0x80
Copy link
Contributor

@0x80 0x80 commented Jun 4, 2017

I noticed that the analytics plugin is broken. It isn't sending any page views other then initial page load. Upon further investigation I found that this is because the onRouteUpdate API is broken.

It turns out that a listener is attached to a history instance, but the history object passed in from routeProps.history on render is used to set window.___history which is used by other code, and apparently this is not the same history instance.

I am not entirely clear where this routeProps.history comes from, but attaching the listener to that instance seems to have fixed the API.

In addition I did some renaming from $() => createInstance() because I think it makes the code more readable.

@0x80 0x80 changed the title Fix onRouteUpdate API [1.0] Fix onRouteUpdate API Jun 4, 2017
@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit ca3c821

https://deploy-preview-1102--using-drupal.netlify.com

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit ca3c821

https://deploy-preview-1102--gatsbyjs.netlify.com

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit ca3c821

https://deploy-preview-1102--gatsbygram.netlify.com

@KyleAMathews
Copy link
Contributor

Looks great! Thanks for diagnosing and fixing the bug.

@KyleAMathews KyleAMathews merged commit 457f7bd into gatsbyjs:1.0 Jun 5, 2017
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.

3 participants