Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: household member delete + order #4510

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const DetailsHouseholdMembers = ({ setMembersDrawer }: DetailsHouseholdMembersPr

return t("t.n/a")
}
return application?.householdMember?.map((item) => ({
const orderedHouseholdMembers = application?.householdMember?.sort(
(a, b) => a.orderId - b.orderId
)
return orderedHouseholdMembers?.map((item) => ({
name: { content: `${item.firstName} ${item.middleName} ${item.lastName}` },
relationship: {
content: item.relationship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ const ApplicationForm = ({ listingId, editMode, application }: ApplicationFormPr

useEffect(() => {
if (application?.householdMember) {
setHouseholdMembers(application.householdMember)
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
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const FormHouseholdMembers = ({
</Drawer>

<Dialog
isOpen={!!membersDeleteModal}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: When the modal number was set to zero (when app submitted on public side) this would be false

isOpen={membersDeleteModal !== null}
ariaLabelledBy="form-household-members-dialog-header"
ariaDescribedBy="form-household-members-dialog-content"
onClose={() => setMembersDeleteModal(null)}
Expand Down