Skip to content

Commit

Permalink
Remove hook from hero that disables featured image output (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymcp authored Dec 10, 2024
2 parents e746e46 + 95e640b commit 23ab913
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions private/src/scripts/editor/blocks/hero/DisplayComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import BlockImageSelector from './components/BlockImageSelector.jsx';
import MediaMetadata from '../../components/MediaMetadata.jsx';
import MediaMetadataVisibilityControls from '../../components/MediaMetadataVisibilityControls.jsx';
import PostFeaturedVideo from '../../components/PostFeaturedVideo.jsx';
import { fetchMediaData, validateBool } from '../utils';
import { fetchMediaData } from '../utils';

const { InnerBlocks, InspectorControls, RichText, URLInputButton } = wp.blockEditor;
const { PanelBody, SelectControl } = wp.components;
const { useEntityRecord } = wp.coreData;
const { useSelect } = wp.data;
const { PostFeaturedImage } = wp.editor;
const { Fragment, useCallback, useEffect, useRef, useState } = wp.element;
const { Fragment, useEffect, useRef, useState } = wp.element;
const { __ } = wp.i18n;

/**
Expand Down Expand Up @@ -50,19 +50,6 @@ const DisplayComponent = (props) => {
const hasDonationBlock = useHasDonationBlock(clientId);
const object = useEntityRecord('postType', postType, postId);

const disableFeaturedImage = useCallback(() => {
// eslint-disable-next-line no-underscore-dangle
if (!validateBool(object?.editedRecord?.meta?._hide_featured_image)) {
object.edit({ meta: { _hide_featured_image: true } });
}
}, [object.edit]);

useEffect(() => {
if (!object.isResolving) {
disableFeaturedImage();
}
}, [object.editedRecord.featured_media]);

useEffect(() => {
if (attributes.type !== 'image') {
return;
Expand Down

0 comments on commit 23ab913

Please sign in to comment.