Skip to content

Commit

Permalink
fix: issues persist with chosing decision maker role (hl-1530 cont.) (#…
Browse files Browse the repository at this point in the history
…3529)

* fix: issue with data format, check for array before mapping

* fix: bugs pre-loading decision maker id/name
  • Loading branch information
sirtawast authored Nov 12, 2024
1 parent db2f099 commit 1a8467c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ const ApplicationList: React.FC<ApplicationListProps> = ({
</strong>
</div>
<ul>
{ahjoError?.errorFromAhjo?.map(({ message }) => (
<li>{message}</li>
))}
{ahjoError?.errorFromAhjo?.map
? ahjoError?.errorFromAhjo?.map(({ message }) => (
<li>{message}</li>
))
: ahjoError?.errorFromAhjo}
</ul>
</Tooltip>
</$ActionErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const ApplicationProcessingView: React.FC<{ data: Application }> = ({
logEntryComment: data?.decisionProposalDraft?.logEntryComment,
justificationText: data?.decisionProposalDraft?.justificationText,
decisionText: data?.decisionProposalDraft?.decisionText,
decisionMakerId: data?.decisionProposalDraft?.decisionMakerId,
decisionMakerName: data?.decisionProposalDraft?.decisionMakerName,
});
}
}, [data, handledApplication, setHandledApplication, isNewAhjoMode]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ const ApplicationReviewStep2: React.FC<HandlingStepProps> = ({
React.useState<string>(handledApplication?.decisionText || '');

const [selectedDecisionMaker, setSelectedDecisionMaker] =
React.useState<DecisionMaker | null>(null);
React.useState<DecisionMaker | null>({
id: handledApplication?.decisionMakerId,
name: handledApplication?.decisionMakerName,
});

const decisionType =
handledApplication?.status === 'accepted'
Expand Down Expand Up @@ -97,10 +100,10 @@ const ApplicationReviewStep2: React.FC<HandlingStepProps> = ({
setSelectedDecisionMaker({
id:
handledApplication?.decisionMakerId ||
decisionProposalDraft.decisionMakerId,
decisionProposalDraft?.decisionMakerId,
name:
handledApplication?.decisionMakerName ||
decisionProposalDraft.decisionMakerName,
decisionProposalDraft?.decisionMakerName,
});
}
}, [
Expand Down

0 comments on commit 1a8467c

Please sign in to comment.