Skip to content

Fix onRouteUpdate & onPreRouteUpdate #7142

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

Merged
merged 2 commits into from
Aug 8, 2018
Merged

Fix onRouteUpdate & onPreRouteUpdate #7142

merged 2 commits into from
Aug 8, 2018

Conversation

KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Aug 8, 2018

Also makes the initial onRouteUpdate actually run after the route has been rendered (previously wasn't)

Also should be more reliable than the previous setTimeout thing as we're using
React's componentDidUpdate lifecycle hook which I believe also ensures
once React async hits that it's run after all children have finished rendering.

Fixes #7142

@KyleAMathews
Copy link
Contributor Author

KyleAMathews commented Aug 8, 2018

Deploy preview for using-postcss-sass failed.

Built with commit 2181e53

https://app.netlify.com/sites/using-postcss-sass/deploys/5b6acebf67610c2209cd8f8c

@gatsbybot
Copy link
Collaborator

gatsbybot commented Aug 8, 2018

Deploy preview for using-drupal ready!

Built with commit 2181e53

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

@gatsbybot
Copy link
Collaborator

gatsbybot commented Aug 8, 2018

Deploy preview for gatsbygram ready!

Built with commit 2181e53

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

@@ -47,11 +46,9 @@ globalHistory.listen(() => {
apiRunner(`onPreRouteUpdate`, { location })
}
// Make sure React has had a chance to flush to DOM first.
Copy link
Contributor

Choose a reason for hiding this comment

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

ditch this comment?

pieh
pieh previously approved these changes Aug 8, 2018
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

👍

@KyleAMathews KyleAMathews changed the title Fix onRouteUpdate Fix onRouteUpdate & onPreRouteUpdate Aug 8, 2018
Copy link
Contributor

@m-allanson m-allanson left a comment

Choose a reason for hiding this comment

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

👍

@KyleAMathews KyleAMathews merged commit 6e46c6a into master Aug 8, 2018
@KyleAMathews KyleAMathews deleted the onRouteUpdate branch August 8, 2018 11:23
@KyleAMathews
Copy link
Contributor Author

Deploy preview for gatsbyjs failed.

Built with commit bd194aa

https://app.netlify.com/sites/gatsbyjs/deploys/5b6ac7e7e39e7c1bf9c35f25

@KyleAMathews
Copy link
Contributor Author

Deploy preview for gatsbyjs failed.

Built with commit 2181e53

https://app.netlify.com/sites/gatsbyjs/deploys/5b6acebe67610c2209cd8f80

m-allanson added a commit that referenced this pull request Aug 8, 2018
* master: (21 commits)
  Disable www-graphql-docker-push.sh (#7127)
  chore(release): Publish
  Fix onRouteUpdate & onPreRouteUpdate (#7142)
  chore(release): Publish
  Fix showing dev 404 page when there isn't one in development (#7140)
  Replace 'serve' package w/ express-static to restore compression (#7139)
  Fix tests (#7138)
  Add delay to cyress test where cyress kept failing
  chore(release): Publish
  (#6581): v2 docs building apps with gatsby overview update (#7115)
  Added my blog to sites (#7125)
  Add babel-plugin-macros (#7129)
  Update babel.md (#7012)
  (#6590): flesh out preparing your environment overview stub (#7137)
  [gatsby-plugin-netlify] update static cache header to match docs (#7132)
  (#7118): Clarify prettier instructions and update tutorial sidebar (#7130)
  Fixing spelling error (#7136)
  chore(release): Publish
  Try publishing again
  chore(release): Publish
  ...

# Conflicts:
#	yarn.lock
m-allanson added a commit that referenced this pull request Aug 8, 2018
* master: (566 commits)
  chore(release): Publish
  Fix mistakenly identifying files as using commonjs when they weren't (#7153)
  Update collectPackages to getPackages for new lerna rc (#7126)
  Update index.md (#7145)
  Disable www-graphql-docker-push.sh (#7127)
  chore(release): Publish
  Fix onRouteUpdate & onPreRouteUpdate (#7142)
  chore(release): Publish
  Fix showing dev 404 page when there isn't one in development (#7140)
  Replace 'serve' package w/ express-static to restore compression (#7139)
  Fix tests (#7138)
  Add delay to cyress test where cyress kept failing
  chore(release): Publish
  (#6581): v2 docs building apps with gatsby overview update (#7115)
  Added my blog to sites (#7125)
  Add babel-plugin-macros (#7129)
  Update babel.md (#7012)
  (#6590): flesh out preparing your environment overview stub (#7137)
  [gatsby-plugin-netlify] update static cache header to match docs (#7132)
  (#7118): Clarify prettier instructions and update tutorial sidebar (#7130)
  ...

# Conflicts:
#	yarn.lock
porfirioribeiro pushed a commit to porfirioribeiro/gatsby that referenced this pull request Aug 22, 2018
* Fix onRouteUpdate

* Apply same treatment to onPreRouteUpdate
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.

4 participants