Skip to content

Commit

Permalink
fix: don't preserve data for under review opps
Browse files Browse the repository at this point in the history
  • Loading branch information
IanFonzie committed Mar 7, 2024
1 parent 25f2065 commit c3722b3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ export const init: component_.base.Init<Params, State, Msg> = ({
DEFAULT_PRICE_WEIGHT
);

// Used to flag when an opportunity is being created (undefined) or edited (draft)
const isStatusNotDraft =
// Used to flag when an opportunity is being created (undefined) or edited (draft/under review)
const isStatusNotDraftOrUnderReview =
opportunity?.status !== TWUOpportunityStatus.Draft &&
opportunity?.status !== TWUOpportunityStatus.UnderReview &&
opportunity?.status !== undefined;

const [tabbedFormState, tabbedFormCmds] = TabbedFormComponent.init({
Expand Down Expand Up @@ -415,7 +416,7 @@ export const init: component_.base.Init<Params, State, Msg> = ({
priceWeight: immutable(priceWeightState),
weightsTotal: immutable(weightsTotalState),
attachments: immutable(attachmentsState),
preserveData: isStatusNotDraft
preserveData: isStatusNotDraftOrUnderReview
},
[
...component_.cmd.mapMany(tabbedFormCmds, (msg) =>
Expand Down

0 comments on commit c3722b3

Please sign in to comment.