@@ -175,7 +175,7 @@ class GlobalSelectionHeader extends React.Component {
175
175
}
176
176
177
177
// Update if URL parameters change
178
- if ( this . didQueryChange ( this . props , nextProps ) ) {
178
+ if ( this . changedQueryKeys ( this . props , nextProps ) . length > 0 ) {
179
179
return true ;
180
180
}
181
181
@@ -232,26 +232,22 @@ class GlobalSelectionHeader extends React.Component {
232
232
* Identifies if query string has changed (with query params that this component cares about)
233
233
*
234
234
*
235
- * @return {Boolean| String[] } Returns `false` if did not change, otherwise return an array of params that have changed
235
+ * @return {String[] } Returns `false` if did not change, otherwise return an array of params that have changed
236
236
*/
237
- didQueryChange = ( prevProps , nextProps ) => {
237
+ changedQueryKeys = ( prevProps , nextProps ) => {
238
238
const urlParamKeys = Object . values ( URL_PARAM ) ;
239
239
const prevQuery = pick ( prevProps . location . query , urlParamKeys ) ;
240
240
const nextQuery = pick ( nextProps . location . query , urlParamKeys ) ;
241
241
242
242
// If no next query is specified keep the previous global selection values
243
243
if ( Object . keys ( prevQuery ) . length === 0 && Object . keys ( nextQuery ) . length === 0 ) {
244
- return false ;
244
+ return [ ] ;
245
245
}
246
246
247
247
const changedKeys = Object . values ( urlParamKeys ) . filter (
248
248
key => ! isEqual ( prevQuery [ key ] , nextQuery [ key ] )
249
249
) ;
250
250
251
- if ( changedKeys . length === 0 ) {
252
- return false ;
253
- }
254
-
255
251
return changedKeys ;
256
252
} ;
257
253
@@ -260,7 +256,7 @@ class GlobalSelectionHeader extends React.Component {
260
256
//
261
257
// e.g. if selection store changed, don't trigger more actions
262
258
// to update global selection store (otherwise we'll get recursive updates)
263
- const changedKeys = this . didQueryChange ( prevProps , nextProps ) ;
259
+ const changedKeys = this . changedQueryKeys ( prevProps , nextProps ) ;
264
260
265
261
if ( changedKeys === false ) {
266
262
return ;
0 commit comments