From 827e08d91fca63bce98edf023f9f5f82fbb24bb9 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Fri, 20 Dec 2024 13:38:12 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20a=20new=20local=20=E2=80=9Cis?=
=?UTF-8?q?Busy=E2=80=9D=20flag=20for=20busy-wrapper?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../js/Components/ReusableComponents/BusyStateWrapper.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/BusyStateWrapper.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/BusyStateWrapper.js
index 959b71bfe..239a088b7 100644
--- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/BusyStateWrapper.js
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/BusyStateWrapper.js
@@ -24,6 +24,7 @@ const BusyContext = createContext( false );
* @param {boolean} props.busySpinner - Allows disabling the spinner in busy-state.
* @param {string} props.className - Additional class names for the wrapper.
* @param {Function} props.onBusy - Callback to process child props when busy.
+ * @param {boolean} props.isBusy - Optional. Additional condition to determine if the component is busy.
*/
const BusyStateWrapper = ( {
children,
@@ -31,11 +32,12 @@ const BusyStateWrapper = ( {
busySpinner = true,
className = '',
onBusy = () => ( { disabled: true } ),
+ isBusy = false,
} ) => {
- const { isBusy } = CommonHooks.useBusyState();
+ const { isBusy: globalIsBusy } = CommonHooks.useBusyState();
const hasBusyParent = useContext( BusyContext );
- const isBusyComponent = isBusy && enabled;
+ const isBusyComponent = ( isBusy || globalIsBusy ) && enabled;
const showSpinner = busySpinner && isBusyComponent && ! hasBusyParent;
const wrapperClassName = classNames( 'ppcp-r-busy-wrapper', className, {