From cdc146f7b51aee64abd8b9eb6977138776b2d708 Mon Sep 17 00:00:00 2001 From: Jeff Cruikshank Date: Wed, 25 Oct 2023 16:04:19 -0700 Subject: [PATCH] Fix accidental mutation of the expiring offers defaults object --- .../src/components/settings/SettingsExpiringOffers.tsx | 3 +-- packages/gui/src/hooks/useOfferExpirationDefaultTime.tsx | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/gui/src/components/settings/SettingsExpiringOffers.tsx b/packages/gui/src/components/settings/SettingsExpiringOffers.tsx index 1c419d4387..c3d662c517 100644 --- a/packages/gui/src/components/settings/SettingsExpiringOffers.tsx +++ b/packages/gui/src/components/settings/SettingsExpiringOffers.tsx @@ -42,7 +42,7 @@ export default function SettingsExpiringOffers(props) { Offer Expiration Time -
+ {fields.map((field) => ( @@ -79,7 +79,6 @@ export default function SettingsExpiringOffers(props) { {isOfferExpirationDefaultTimeEnabled && ( ( 'offerExpirationDefaultTime', - offerExpirationDefaultTimeDefaults + defaultsCopy // to avoid accidentally mutating the defaults object ); - const isOfferExpirationDefaultTimeEnabled = useMemo( - () => offerExpirationDefaultTime.enabled === true, - [offerExpirationDefaultTime] - ); + const isOfferExpirationDefaultTimeEnabled = offerExpirationDefaultTime.enabled === true; const setOfferExpirationDefaultTime = useCallback( (offerExpirationDefaultTimeInput: OfferExpirationDefaultTimeInput) => { @@ -68,5 +66,6 @@ export default function useOfferExpirationDefaultTime() { () => ({ offerExpirationDefaultTime, setOfferExpirationDefaultTime, isOfferExpirationDefaultTimeEnabled }), [offerExpirationDefaultTime, setOfferExpirationDefaultTime, isOfferExpirationDefaultTimeEnabled] ); + return toReturn; }