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:
Gan Eng Chin 2023-03-11 00:42:09 +08:00
parent 1fea0185fe
commit c6e6f8774d
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
1 changed files with 2 additions and 2 deletions

View File

@ -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,