-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Conversation
Deploy preview for using-postcss-sass failed. Built with commit 2181e53 https://app.netlify.com/sites/using-postcss-sass/deploys/5b6acebf67610c2209cd8f8c |
Deploy preview for using-drupal ready! Built with commit 2181e53 |
Deploy preview for gatsbygram ready! Built with commit 2181e53 |
@@ -47,11 +46,9 @@ globalHistory.listen(() => { | |||
apiRunner(`onPreRouteUpdate`, { location }) | |||
} | |||
// Make sure React has had a chance to flush to DOM first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditch this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Deploy preview for gatsbyjs failed. Built with commit bd194aa https://app.netlify.com/sites/gatsbyjs/deploys/5b6ac7e7e39e7c1bf9c35f25 |
Deploy preview for gatsbyjs failed. Built with commit 2181e53 https://app.netlify.com/sites/gatsbyjs/deploys/5b6acebe67610c2209cd8f80 |
* 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
* 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
* Fix onRouteUpdate * Apply same treatment to onPreRouteUpdate
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 ensuresonce React async hits that it's run after all children have finished rendering.
Fixes #7142