Specify empty array dependency in useCampaignTypes.
This is to make it work with WP 5.9. See https://github.com/woocommerce/woocommerce/pull/37044#discussion_r1132062493.
This commit is contained in:
parent
1fea0185fe
commit
c6e6f8774d
|
@ -38,7 +38,7 @@ export const useCampaignTypes = (): UseCampaignTypes => {
|
|||
const { invalidateResolution } = useDispatch( STORE_KEY );
|
||||
|
||||
const refetch = useCallback( () => {
|
||||
invalidateResolution( 'getCampaignTypes' );
|
||||
invalidateResolution( 'getCampaignTypes', [] );
|
||||
}, [ invalidateResolution ] );
|
||||
|
||||
return useSelect< UseCampaignTypes >(
|
||||
|
@ -48,7 +48,7 @@ export const useCampaignTypes = (): UseCampaignTypes => {
|
|||
const campaignTypesState = getCampaignTypes< CampaignTypesState >();
|
||||
|
||||
return {
|
||||
loading: ! hasFinishedResolution( 'getCampaignTypes' ),
|
||||
loading: ! hasFinishedResolution( 'getCampaignTypes', [] ),
|
||||
data: campaignTypesState.data?.map( convert ),
|
||||
error: campaignTypesState.error,
|
||||
refetch,
|
||||
|
|
Loading…
Reference in New Issue