diff --git a/src/pages/settings/Subscription/SubscriptionSize/index.tsx b/src/pages/settings/Subscription/SubscriptionSize/index.tsx index 4235656aabf6..961bb5d46b57 100644 --- a/src/pages/settings/Subscription/SubscriptionSize/index.tsx +++ b/src/pages/settings/Subscription/SubscriptionSize/index.tsx @@ -8,6 +8,7 @@ import useSubStep from '@hooks/useSubStep'; import type {SubStepProps} from '@hooks/useSubStep/types'; import Navigation from '@libs/Navigation/Navigation'; import type {SettingsNavigatorParamList} from '@navigation/types'; +import * as FormActions from '@userActions/FormActions'; import * as Subscription from '@userActions/Subscription'; import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; @@ -29,6 +30,7 @@ function SubscriptionSizePage({route}: SubscriptionSizePageProps) { const onFinished = () => { Subscription.updateSubscriptionSize(subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0, privateSubscription?.userCount ?? 0); Navigation.goBack(); + FormActions.clearDraftValues(ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM); }; const {componentToRender: SubStep, screenIndex, nextScreen, prevScreen, moveTo} = useSubStep({bodyContent, startFrom, onFinished}); diff --git a/src/pages/settings/Subscription/SubscriptionSize/substeps/Confirmation.tsx b/src/pages/settings/Subscription/SubscriptionSize/substeps/Confirmation.tsx index 6a461c1a9082..dbb78e538239 100644 --- a/src/pages/settings/Subscription/SubscriptionSize/substeps/Confirmation.tsx +++ b/src/pages/settings/Subscription/SubscriptionSize/substeps/Confirmation.tsx @@ -23,8 +23,10 @@ function Confirmation({onNext, isEditing}: ConfirmationProps) { const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); const [subscriptionSizeFormDraft] = useOnyx(ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM_DRAFT); const subscriptionRenewalDate = getNewSubscriptionRenewalDate(); + const subscriptionSizeDraft = subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0; + const subscriptionSize = subscriptionSizeDraft || (privateSubscription?.userCount ?? 0); - const isTryingToIncreaseSubscriptionSize = (subscriptionSizeFormDraft ? Number(subscriptionSizeFormDraft[INPUT_IDS.SUBSCRIPTION_SIZE]) : 0) > (privateSubscription?.userCount ?? 0); + const isTryingToIncreaseSubscriptionSize = subscriptionSizeDraft > (privateSubscription?.userCount ?? 0); const canChangeSubscriptionSize = (account?.canDowngrade ?? false) || (isTryingToIncreaseSubscriptionSize && isEditing); const formattedSubscriptionEndDate = formatSubscriptionEndDate(privateSubscription?.endDate); @@ -41,7 +43,7 @@ function Confirmation({onNext, isEditing}: ConfirmationProps) {