From e7fb1e85167d5a5894046b3afadca9a77d971944 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Thu, 25 Jan 2024 07:53:35 +0000 Subject: [PATCH] Reset notice on each action --- .../src/components/global-styles/font-library-modal/context.js | 2 ++ .../global-styles/font-library-modal/font-collection.js | 2 ++ .../global-styles/font-library-modal/installed-fonts.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/context.js b/packages/edit-site/src/components/global-styles/font-library-modal/context.js index 1f3a336cd46e0..2b9efd2ddccd6 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/context.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/context.js @@ -144,6 +144,8 @@ function FontLibraryProvider( { children } ) { }, [ modalTabOpen ] ); const handleSetLibraryFontSelected = ( font ) => { + setNotice( null ); + // If font is null, reset the selected font if ( ! font ) { setLibraryFontSelected( null ); diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js index ab0942e03da32..95572bd1bc9d7 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js @@ -142,6 +142,8 @@ function FontCollection( { slug } ) { }; const handleInstall = async () => { + setNotice( null ); + const fontFamily = fontsToInstall[ 0 ]; try { diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js index 60d7145f2e938..ec372f3b1fd13 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js @@ -47,6 +47,8 @@ function InstalledFonts() { }; const handleConfirmUninstall = async () => { + setNotice( null ); + try { await uninstallFontFamily( libraryFontSelected ); setNotice( {