Skip to content

Commit

Permalink
refactor var name to reflect value
Browse files Browse the repository at this point in the history
  • Loading branch information
CGastrell committed Dec 19, 2024
1 parent e8e1983 commit 6907d27
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -93,7 +92,7 @@ export default function FeaturedImage( {
const toggleEditorPanelOpened =
toggleEditorPanelOpenedFromEditor ?? toggleEditorPanelOpenedFromEditPost;

debug( 'postFeatureMedia', postFeaturedMedia );
debug( 'postFeaturedMediaId', postFeaturedMediaId );

const {
pointer,
Expand All @@ -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( () => {
Expand Down Expand Up @@ -364,7 +363,7 @@ export default function FeaturedImage( {
disabled={
! currentImage?.image ||
currentImage?.generating ||
currentImage?.libraryId === postFeaturedMedia
currentImage?.libraryId === postFeaturedMediaId
}
>
{ __( 'Set as featured image', 'jetpack' ) }
Expand All @@ -389,7 +388,7 @@ export default function FeaturedImage( {
) }
<AiImageModal
postContent={ hasContent }
autoStart={ hasContent && ! postFeaturedMedia }
autoStart={ hasContent && ! postFeaturedMediaId }
autoStartAction={ handleFirstGenerate }
images={ images }
currentIndex={ current }
Expand Down

0 comments on commit 6907d27

Please sign in to comment.