order (e.g. Clients → Client’s Agent → Listing Agent), not by how rows were added or synced into inspection.people.order field on populated roles in the people array—the same sort key companies configure under contact roles._roleId.order (with a high fallback when order is missing) in PeopleBox before rendering.inspection.people through unchanged; ContactsList maps the array in API/storage order, so Listing Agent or other roles can appear above Client or Client’s Agent even when role settings say otherwise.order on populated people._roleId; mobile types omit it but the value is available at runtime when people is populated.
Backend
order on contactRolesSchema (attik-backend/src/models/contactRolesSchema.ts, default 9999).populate: people include role order via people._roleId select in attik-backend/src/routes/inspection.ts (name, icon, description, portalPermissions, order). Aggregation population in attik-backend/src/util/functions/aggregation/inspectionPopulation.ts merges full role objects into people—no change required unless mobile populate paths differ.Frontend (reference behavior)
attik-frontend/src/components/ui/PeopleBox.tsx is the parity target: roleDisplayOrder reads Number(role.order) with fallback 9999, comparePeopleForDisplay sorts people before grouping by role. Mobile should behave consistently with this pattern; exact reuse vs. local helper is a dev choice.Mobile
attik-mobile/app/(app)/inspection/[id].tsx builds people from inspection?.people and renders <ContactsList people={people} /> with no sort.attik-mobile/components/inspection/ContactsList.tsx maps people in array order.attik-mobile/types/index.ts — ContactRole currently has _id, name, type only; extending types for order may be needed for clarity.attik-mobile/hooks/useInspectionDetails.ts and useInspections.ts request populated people—data should include order when populated.uniquePeople list and client-portal dropdown options in [id].tsx are built from the same unsorted people loop; sorting for the Contacts section should keep portal option order aligned with the visible contact list.order values in settings; reordering rows inside inspection.people on the server.Decision needed
ContactsList only vs. a shared sorted people memo in [id].tsx (portal dropdown and any other consumers).order (web uses contact id string compare after role order).attik-mobile/app/(app)/inspection/[id].tsx, attik-mobile/components/inspection/ContactsList.tsxattik-frontend/src/components/ui/PeopleBox.tsxattik-backend/src/routes/inspection.ts, attik-backend/src/models/contactRolesSchema.tsPlease authenticate to join the conversation.
Planned
Main App
2 days ago
Linear
Get notified by email when there are changes.
Planned
Main App
2 days ago
Linear
Get notified by email when there are changes.