From a36fd02987a61b5c4f65c1511dae8c8524474bc3 Mon Sep 17 00:00:00 2001 From: Renato Augusto Gama dos Santos Date: Thu, 2 May 2024 10:52:42 -0300 Subject: [PATCH] Media Store: Update call to is inserter opened --- .../shared/external-media/media-service/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts b/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts index d79a6eeb7334a..394396bc8a344 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts +++ b/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts @@ -199,11 +199,12 @@ const isInserterOpened = (): boolean => { // Prior to WP 6.5, the isInserterOpened selector was available in core/edit-post. // In WP 6.5, it was moved to core/editor. This check is to support both versions of WordPress. // @to-do: remove exception when Jetpack requires WordPress 6.5. - /* eslint-disable @typescript-eslint/no-explicit-any */ - const editorIsInserterOpened = ( select( 'core/editor' ) as any )?.isInserterOpened?.() - ? ( select( 'core/editor' ) as any )?.isInserterOpened?.() - : select( 'core/edit-post' )?.isInserterOpened(); - /* eslint-enable @typescript-eslint/no-explicit-any */ + const selectIsInserterOpened = + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ + ( select( 'core/editor' ) as any )?.isInserterOpened ?? + select( 'core/edit-post' )?.isInserterOpened; + + const editorIsInserterOpened = selectIsInserterOpened?.(); return ( editorIsInserterOpened ||