Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 07bea54

Browse files
Aljullunerrad
authored andcommitted
Preserve query key order in All Products
1 parent 7458838 commit 07bea54

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

assets/js/base/hooks/use-query-state.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { QUERY_STATE_STORE_KEY as storeKey } from '@woocommerce/block-data';
55
import { useSelect, useDispatch } from '@wordpress/data';
66
import { useRef, useEffect, useCallback } from '@wordpress/element';
77
import { useQueryStateContext } from '@woocommerce/base-context/query-state-context';
8+
import { assign } from 'lodash';
89

910
/**
1011
* Internal dependencies
@@ -122,10 +123,7 @@ export const useSynchronizedQueryState = ( synchronizedQuery, context ) => {
122123
const isInitialized = useRef( false );
123124
// update queryState anytime incoming synchronizedQuery changes
124125
useEffect( () => {
125-
setQueryState( {
126-
...queryState,
127-
...currentSynchronizedQuery,
128-
} );
126+
setQueryState( assign( {}, queryState, currentSynchronizedQuery ) );
129127
isInitialized.current = true;
130128
}, [ currentSynchronizedQuery ] );
131129
return isInitialized.current

0 commit comments

Comments
 (0)