diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx index bb9eed05bad2a..db2589ce386e5 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx @@ -31,7 +31,7 @@ import { PLACEMENT_MEDIA_SOURCE_DROPDOWN, } from './types'; import type { ImageResponse } from './hooks/use-ai-image'; -import type { SelectState, EditorSelectors, CoreSelectors } from './types'; +import type { EditorSelectors, CoreSelectors } from './types'; const debug = debugFactory( 'jetpack-ai:featured-image' ); @@ -87,19 +87,15 @@ export default function FeaturedImage( { // https://github.com/WordPress/gutenberg/blob/fe4d8cb936df52945c01c1863f7b87b58b7cc69f/packages/edit-post/CHANGELOG.md?plain=1#L19 const toggleEditorPanelOpened = toggleEditorPanelOpenedFromEditor ?? toggleEditorPanelOpenedFromEditPost; - const isEditorPanelOpened = useSelect( - ( select: ( store: keyof SelectState ) => EditorSelectors ) => { - const isOpened = - select( 'core/editor' ).isEditorPanelOpened ?? - select( 'core/edit-post' ).isEditorPanelOpened; - return isOpened; - }, - [] - ); + const isEditorPanelOpened = useSelect( ( select: ( store ) => EditorSelectors ) => { + const isOpened = + select( editorStore ).isEditorPanelOpened ?? select( 'core/edit-post' ).isEditorPanelOpened; + return isOpened; + }, [] ); const currentFeaturedMedia = useSelect( - ( select: ( store: keyof SelectState ) => EditorSelectors & CoreSelectors ) => { - const mediaId = select( 'core/editor' )?.getEditedPostAttribute?.( 'featured_media' ); + ( select: ( store ) => EditorSelectors & CoreSelectors ) => { + const mediaId = select( editorStore )?.getEditedPostAttribute?.( 'featured_media' ); return mediaId ? select( 'core' )?.getMedia?.( mediaId as number ) : null; }, [] diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/types.ts b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/types.ts index 6e33b519ff75b..77f688f7dd94a 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/types.ts +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/types.ts @@ -17,9 +17,3 @@ export interface CoreSelectors { source_url: string; } | null; } - -export interface SelectState { - 'core/editor': EditorSelectors; - 'core/edit-post': EditorSelectors; - core: CoreSelectors; -}