Skip to content

Commit

Permalink
fix: handle null order id
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck committed Dec 23, 2024
1 parent 1e0433f commit 9a0a5dd
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ const ApplicationForm = ({ listingId, editMode, application }: ApplicationFormPr

useEffect(() => {
if (application?.householdMember) {
const orderedHouseholdMembers = application.householdMember.sort(
(a, b) => a.orderId - b.orderId
)
const householdMemberNum = application.householdMember.length
const orderedHouseholdMembers = application.householdMember
//reset order ids to show members in order user added them
.map((member, idx) => {
return { ...member, orderId: householdMemberNum - idx }
})
.sort((a, b) => a.orderId - b.orderId)
setHouseholdMembers(orderedHouseholdMembers)
}
}, [application, setHouseholdMembers])
Expand Down

0 comments on commit 9a0a5dd

Please sign in to comment.