From e64b4fcbfca9180ed2c8085704fffe0a15960a00 Mon Sep 17 00:00:00 2001 From: Stephen Cleary Date: Thu, 18 Mar 2021 17:51:09 -0400 Subject: [PATCH] Fix argument order for onPreRouteUpdate The argument for `shouldComponentUpdate` is the *next* props, not the *previous* props, so `onPreRouteUpdate` was getting called with arguments in the reverse order. --- packages/gatsby/cache-dir/navigation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/cache-dir/navigation.js b/packages/gatsby/cache-dir/navigation.js index 686769c6a6948..e3342508b9212 100644 --- a/packages/gatsby/cache-dir/navigation.js +++ b/packages/gatsby/cache-dir/navigation.js @@ -242,9 +242,9 @@ class RouteUpdates extends React.Component { onRouteUpdate(this.props.location, null) } - shouldComponentUpdate(prevProps) { - if (compareLocationProps(prevProps.location, this.props.location)) { - onPreRouteUpdate(this.props.location, prevProps.location) + shouldComponentUpdate(nextProps) { + if (compareLocationProps(this.props.location, nextProps.location)) { + onPreRouteUpdate(nextProps.location, this.props.location) return true } return false