Skip to content

Commit

Permalink
Revert "Fix: Shadow/Font size preset panel crashes the editor (WordPr…
Browse files Browse the repository at this point in the history
…ess#65765)"

This reverts commit f162973.
  • Loading branch information
huubl authored Oct 2, 2024
1 parent 5183bf4 commit 0aaaa79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ function FontSize() {
// Get the font size by slug.
const fontSize = sizes.find( ( size ) => size.slug === slug );

// Navigate to the font sizes list if the font size is not available.
useEffect( () => {
if ( ! fontSize ) {
goTo( '/typography/font-sizes/', { isBack: true } );
}
}, [ fontSize, goTo ] );

if ( ! origin || ! slug || ! fontSize ) {
return null;
}

// Whether the font size is fluid. If not defined, use the global fluid value of the theme.
const isFluid =
fontSize?.fluid !== undefined ? !! fontSize.fluid : !! globalFluid;
Expand Down Expand Up @@ -132,6 +121,18 @@ function FontSize() {
setIsRenameDialogOpen( ! isRenameDialogOpen );
};

// Navigate to the font sizes list if the font size is not available.
useEffect( () => {
if ( ! fontSize ) {
goTo( '/typography/font-sizes/', { isBack: true } );
}
}, [ fontSize, goTo ] );

// Avoid rendering if the font size is not available.
if ( ! fontSize ) {
return null;
}

return (
<>
<ConfirmDeleteFontSizeDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ export default function ShadowsEditPanel() {
const [ isRenameModalVisible, setIsRenameModalVisible ] = useState( false );
const [ shadowName, setShadowName ] = useState( selectedShadow.name );

if ( ! category || ! slug ) {
return null;
}

const onShadowChange = ( shadow ) => {
setSelectedShadow( { ...selectedShadow, shadow } );
const updatedShadows = shadows.map( ( s ) =>
Expand Down

0 comments on commit 0aaaa79

Please sign in to comment.