This commit is contained in:
Albert Juhé Lluveras 2020-01-20 13:04:13 +01:00 committed by GitHub
parent ae3c3189d2
commit e607ce2d1a
1 changed files with 2 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import { QUERY_STATE_STORE_KEY as storeKey } from '@woocommerce/block-data';
import { useSelect, useDispatch } from '@wordpress/data';
import { useRef, useEffect, useCallback } from '@wordpress/element';
import { useQueryStateContext } from '@woocommerce/base-context/query-state-context';
import { assign } from 'lodash';
/**
* Internal dependencies
@ -122,10 +123,7 @@ export const useSynchronizedQueryState = ( synchronizedQuery, context ) => {
const isInitialized = useRef( false );
// update queryState anytime incoming synchronizedQuery changes
useEffect( () => {
setQueryState( {
...queryState,
...currentSynchronizedQuery,
} );
setQueryState( assign( {}, queryState, currentSynchronizedQuery ) );
isInitialized.current = true;
}, [ currentSynchronizedQuery ] );
return isInitialized.current