Specify args for wp.data resolution in marketing page to support WP 5.9 (#37198)

This commit is contained in:
Gan Eng Chin 2023-03-15 07:30:40 +08:00 committed by GitHub
commit 98dcb9bea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -40,7 +40,7 @@ export const useRecommendedChannels = (): UseRecommendedChannels => {
} ); } );
return { return {
loading: ! hasFinishedResolution( 'getRecommendedChannels' ), loading: ! hasFinishedResolution( 'getRecommendedChannels', [] ),
data: nonActiveRecommendedChannels, data: nonActiveRecommendedChannels,
error, error,
}; };

View File

@ -63,7 +63,7 @@ export const useRegisteredChannels = (): UseRegisteredChannels => {
const { invalidateResolution } = useDispatch( STORE_KEY ); const { invalidateResolution } = useDispatch( STORE_KEY );
const refetch = useCallback( () => { const refetch = useCallback( () => {
invalidateResolution( 'getRegisteredChannels' ); invalidateResolution( 'getRegisteredChannels', [] );
}, [ invalidateResolution ] ); }, [ invalidateResolution ] );
return useSelect( ( select ) => { return useSelect( ( select ) => {
@ -72,7 +72,7 @@ export const useRegisteredChannels = (): UseRegisteredChannels => {
const state = getRegisteredChannels< RegisteredChannelsState >(); const state = getRegisteredChannels< RegisteredChannelsState >();
return { return {
loading: ! hasFinishedResolution( 'getRegisteredChannels' ), loading: ! hasFinishedResolution( 'getRegisteredChannels', [] ),
data: state.data?.map( convert ), data: state.data?.map( convert ),
error: state.error, error: state.error,
refetch, refetch,

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix WP data resolution (`invalidateResolution`) not working with WP 5.9 in marketing page.