From 23e1f7f235f6d4d572a76253d4803033fe14c5f0 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Tue, 8 Oct 2024 12:06:00 +0200 Subject: [PATCH 1/3] Global styles: remove trailing slack from font sizes screen path --- .../src/components/global-styles/font-sizes/font-sizes-count.js | 2 +- packages/edit-site/src/components/global-styles/ui.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/font-sizes/font-sizes-count.js b/packages/edit-site/src/components/global-styles/font-sizes/font-sizes-count.js index 8c8c79772ecbf..c268648a134a7 100644 --- a/packages/edit-site/src/components/global-styles/font-sizes/font-sizes-count.js +++ b/packages/edit-site/src/components/global-styles/font-sizes/font-sizes-count.js @@ -24,7 +24,7 @@ function FontSizes() { diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index fbc3e461e6abb..d534da901cd2e 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -302,7 +302,7 @@ function GlobalStylesUI() { - + From 5910c7bea9084476c398fa09d74617219d96e5ec Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Tue, 8 Oct 2024 12:06:24 +0200 Subject: [PATCH 2/3] Remove unncessary goTo --- .../src/components/global-styles/font-sizes/font-size.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles/font-sizes/font-size.js b/packages/edit-site/src/components/global-styles/font-sizes/font-size.js index b99703d39c8d6..00c32961c7b7d 100644 --- a/packages/edit-site/src/components/global-styles/font-sizes/font-size.js +++ b/packages/edit-site/src/components/global-styles/font-sizes/font-size.js @@ -158,7 +158,6 @@ function FontSize() { __( 'Manage the font size %s.' ), fontSize.name ) } - onBack={ () => goTo( '/typography/font-sizes/' ) } /> { origin === 'custom' && ( From 28ce4031a769da2d2223f059f14833ee11656279 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Tue, 8 Oct 2024 12:08:18 +0200 Subject: [PATCH 3/3] Use goBack instead of goTo, add extra slug check to avoid double goBack call --- .../src/components/global-styles/font-sizes/font-size.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/font-sizes/font-size.js b/packages/edit-site/src/components/global-styles/font-sizes/font-size.js index 00c32961c7b7d..43418f9caf5eb 100644 --- a/packages/edit-site/src/components/global-styles/font-sizes/font-size.js +++ b/packages/edit-site/src/components/global-styles/font-sizes/font-size.js @@ -36,7 +36,7 @@ function FontSize() { const { params: { origin, slug }, - goTo, + goBack, } = useNavigator(); const [ fontSizes, setFontSizes ] = useGlobalSetting( @@ -53,10 +53,10 @@ function FontSize() { // Navigate to the font sizes list if the font size is not available. useEffect( () => { - if ( ! fontSize ) { - goTo( '/typography/font-sizes/', { isBack: true } ); + if ( !! slug && ! fontSize ) { + goBack(); } - }, [ fontSize, goTo ] ); + }, [ slug, fontSize, goBack ] ); if ( ! origin || ! slug || ! fontSize ) { return null;