From 6907d27150cda7aba85d8bf45483fdac9e81ccbe Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Thu, 19 Dec 2024 15:26:08 -0300 Subject: [PATCH] refactor var name to reflect value --- .../components/ai-image/featured-image.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 874cf1d4067be..60ce8005deb0c 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 @@ -51,11 +51,10 @@ export default function FeaturedImage( { ); const siteType = useSiteType(); const postContent = usePostContent(); - const { postTitle, postFeaturedMedia, isEditorPanelOpened } = useSelect( select => { - const featuredMediaId = select( editorStore ).getEditedPostAttribute( 'featured_media' ); + const { postTitle, postFeaturedMediaId, isEditorPanelOpened } = useSelect( select => { return { postTitle: select( editorStore ).getEditedPostAttribute( 'title' ), - postFeaturedMedia: featuredMediaId, + postFeaturedMediaId: select( editorStore ).getEditedPostAttribute( 'featured_media' ), isEditorPanelOpened: select( editorStore ).isEditorPanelOpened ?? ( select( 'core/edit-post' ) as EditorSelectors ).isEditorPanelOpened, @@ -93,7 +92,7 @@ export default function FeaturedImage( { const toggleEditorPanelOpened = toggleEditorPanelOpenedFromEditor ?? toggleEditorPanelOpenedFromEditPost; - debug( 'postFeatureMedia', postFeaturedMedia ); + debug( 'postFeaturedMediaId', postFeaturedMediaId ); const { pointer, @@ -112,7 +111,7 @@ export default function FeaturedImage( { cost: featuredImageCost, type: 'featured-image-generation', feature: FEATURED_IMAGE_FEATURE_NAME, - previousMediaId: postFeaturedMedia, + previousMediaId: postFeaturedMediaId, } ); const handleModalClose = useCallback( () => { @@ -364,7 +363,7 @@ export default function FeaturedImage( { disabled={ ! currentImage?.image || currentImage?.generating || - currentImage?.libraryId === postFeaturedMedia + currentImage?.libraryId === postFeaturedMediaId } > { __( 'Set as featured image', 'jetpack' ) } @@ -389,7 +388,7 @@ export default function FeaturedImage( { ) }