Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ 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 @@ -121,18 +132,6 @@ 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,6 +96,10 @@ 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