Skip to content

Commit 28ce403

Browse files
committed
Use goBack instead of goTo, add extra slug check to avoid double goBack call
1 parent 5910c7b commit 28ce403

File tree

1 file changed

+4
-4
lines changed
  • packages/edit-site/src/components/global-styles/font-sizes

1 file changed

+4
-4
lines changed

packages/edit-site/src/components/global-styles/font-sizes/font-size.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function FontSize() {
3636

3737
const {
3838
params: { origin, slug },
39-
goTo,
39+
goBack,
4040
} = useNavigator();
4141

4242
const [ fontSizes, setFontSizes ] = useGlobalSetting(
@@ -53,10 +53,10 @@ function FontSize() {
5353

5454
// Navigate to the font sizes list if the font size is not available.
5555
useEffect( () => {
56-
if ( ! fontSize ) {
57-
goTo( '/typography/font-sizes/', { isBack: true } );
56+
if ( !! slug && ! fontSize ) {
57+
goBack();
5858
}
59-
}, [ fontSize, goTo ] );
59+
}, [ slug, fontSize, goBack ] );
6060

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

0 commit comments

Comments
 (0)