From e1f10870d497e5ccbb9e9edafa4421b6f590f08c Mon Sep 17 00:00:00 2001 From: Fishbakh-N Date: Fri, 10 Apr 2026 21:42:34 +0300 Subject: [PATCH] fix: prevent fetching customization without a code --- .../widget/context/NonprofitContext.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx b/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx index c07d92c4..fd59c510 100644 --- a/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx +++ b/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx @@ -62,11 +62,18 @@ export const NonprofitContextProvider: FunctionalComponent<{ } } - try { - const customizationResponse = await getCustomization(response.id, code); - setCustomization(customizationResponse); - } catch { - setCustomization(DonateFlowCustomizationFetchError); + if (code) { + try { + const customizationResponse = await getCustomization( + response.id, + code + ); + setCustomization(customizationResponse); + } catch { + setCustomization(DonateFlowCustomizationFetchError); + } + } else { + setCustomization(undefined); } } catch { setNonprofit(NonprofitFetchError);