diff --git a/packages/block-editor/src/components/inserter/media-tab/hooks.js b/packages/block-editor/src/components/inserter/media-tab/hooks.js index f537dce68608ad..e3b68510d77d2e 100644 --- a/packages/block-editor/src/components/inserter/media-tab/hooks.js +++ b/packages/block-editor/src/components/inserter/media-tab/hooks.js @@ -66,14 +66,15 @@ export function useMediaCategories( rootClientId ) { per_page: 1, _fields: [ 'id' ], }; - const [ image, video, audio ] = await Promise.all( [ + const [ image, video, audio ] = await Promise.allSettled( [ fetchMedia( { ...query, media_type: 'image' } ), fetchMedia( { ...query, media_type: 'video' } ), fetchMedia( { ...query, media_type: 'audio' } ), ] ); - const showImage = canInsertImage && !! image.length; - const showVideo = canInsertVideo && !! video.length; - const showAudio = canInsertAudio && !! audio.length; + // The `value` property is only present if the promise's status is "fulfilled". + const showImage = canInsertImage && !! image.value?.length; + const showVideo = canInsertVideo && !! video.value?.length; + const showAudio = canInsertAudio && !! audio.value?.length; setCategories( MEDIA_CATEGORIES.filter( ( { mediaType } ) =>