Undefined inspector names in client agreement merge fields

Objective

  • Ensure inspector list merge fields on client agreements render real inspector names (or a deliberate fallback), never the literal "undefined", in the client portal.

Background

  • Inspectors are assigned on the job, but agreement rendering still shows broken text—this damages trust on legal documents.

Scope

Frontend

  • Merge-field resolution for inspector-list in attik-frontend/src/components/conditions/templatingData.ts (and any agreement-specific templating path that reuses it).
  • Client agreement / portal inspection fetch: align with the observation that GET inspection/slug/:slug may omit populate=inspectors.

Backend

  • Inspection-by-slug handler in attik-backend should either populate inspector docs for agreement rendering or expose a stable display-name helper (e.g. inspectorDisplayName pattern referenced in existing notes).

References

  • attik-frontend/src/components/conditions/templatingData.ts (key inspector-list)
  • attik-backend/src/routes/ (inspection slug route—locate inspection/slug handler)

Original description

Users have reported that the inspector list merge field on agreements sometimes shows the word "undefined" in the client agreement view, even when inspectors are assigned to the job. They expect agreement text to show the actual inspector names (or a sensible fallback), especially in the client portal when reviewing or signing.

Why it matters: Wrong or broken text on legal agreements undermines trust and forces staff to fix documents manually.


Engineering scope (for implementation):

  • Client agreement page loads inspection via GET inspection/slug/:slug without populate=inspectors, so _inspectorId is often raw ids, not populated inspector docs.
  • Frontend inspector-list in templatingData.ts uses only inspector.name; string ids yield template literal "undefined". Align with backend inspectorDisplayName (firstName/lastName, then name, then email) and/or ensure portal inspection fetch populates inspectors when rendering agreements.

Ex: https://www.attik.ai/inspections/1008589216

Please authenticate to join the conversation.

Upvoters
Status

Code Review

Board
🏠

Main App

Date

26 days ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.