Aman-Mittal opened a new issue, #611:
URL: https://github.com/apache/fineract-backoffice-ui/issues/611

   Swept all 109 routes reachable from the nav menu on the deployed build 
(`c7a34a87`). Four of them throw during load and still paint a normal empty 
state. The operator is told there is no data; there is data, or there is a 
server fault, and nothing on screen says so.
   
   | Route | What actually happens | What the screen says |
   |---|---|---|
   | `/system/entity-mapping` | `SyntaxError: Unexpected token 'o', "[object 
Obj"... is not valid JSON` | No records found. |
   | `/system/report-mailing-jobs` | `TypeError: t is not iterable` | No 
records found. |
   | `/products/interest-rate-charts` | `HTTP 500` on `/interestratecharts` | 
No records found. |
   | `/system/bulk-import` | `HTTP 404` on `/imports?entityType=clients` | No 
records found. |
   
   
![entity-mapping](https://raw.githubusercontent.com/Aman-Mittal/fineract-backoffice-ui/ux-audit-screens-2026-09-21/screens/entity-mapping-silent-empty.jpeg)
   
   
![report-mailing-jobs](https://raw.githubusercontent.com/Aman-Mittal/fineract-backoffice-ui/ux-audit-screens-2026-09-21/screens/report-mailing-jobs-silent-empty.jpeg)
   
   ## The two client-side ones are the same defect
   
   Both assume a response shape the API no longer returns.
   
   **`entity-mapping-list.component.ts:114`** parses a value that is already 
deserialised:
   
   ```ts
   next: (body: string) => {
     this.mappings.set(body ? (JSON.parse(body) as EntityToEntityMapping[]) : 
[]);
   },
   ```
   
   The generated client deserialises JSON itself, so `body` is an object. 
`JSON.parse` stringifies it to `"[object Object]"` and throws. Stack confirms 
the throw is inside `Object.next`.
   
   **`report-mailing-jobs-list.component.ts:235`** is typed for a bare array:
   
   ```ts
   next: (data: GetReportMailingJobsResponse[]) => {
     this.jobs.set(data || []);
   },
   ```
   
   The endpoint returns a paged envelope, so `jobs()` holds an object and a 
downstream `computed()` throws `t is not iterable` — the stack points at 
`Object.computation`, not at the subscribe. Note `loadRunHistory()` in the same 
file already handles this correctly with an `Array.isArray(data) ? data : 
data?.pageItems ?? []` guard; `load()` never got the same treatment.
   
   ## Why the existing error handling does not catch it
   
   Both components have an `error:` callback, and neither fires. The exception 
is thrown *inside* `next`, after the request succeeded, so RxJS never routes it 
to `error:`. The `app-load-error` component added recently is wired to the 
`error:` path, which means it cannot surface this class of failure as things 
stand.
   
   That is the part worth fixing structurally: a load that throws while mapping 
a successful response currently degrades to "empty", everywhere this pattern 
appears.
   
   ## Related unguarded call sites
   
   These use the same bare `JSON.parse(raw)` on a response. None threw during 
the sweep — the endpoints returned nothing that exercised the branch — so they 
are latent rather than confirmed broken, but they will fail the same way if the 
shape changes:
   
   - `entity-mapping-form.component.ts:183`
   - `office-transactions-list.component.ts:180`
   - `office-transaction-form.component.ts:223`
   - `email-campaigns-list.component.ts:219`
   - `email-messages.component.ts:359`
   - `survey-responses.component.ts:221`
   
   Most other `JSON.parse` uses in `features/` are already guarded with `typeof 
raw === 'string' ? JSON.parse(raw) : raw`, or are parsing a JSON textarea the 
user typed, which is legitimate.
   
   ## Suggested fix
   
   1. Drop `JSON.parse` on generated-client responses; read the typed object 
directly.
   2. Where an endpoint returns a paged envelope, read `pageItems` with the 
`Array.isArray` guard already used in `loadRunHistory()`.
   3. Give the list screens a distinct failed-to-load state so a fault cannot 
render as "No records found." — including when the throw happens in the success 
path.
   
   The two server faults (500, 404) are upstream problems, but they surface the 
same way and would be covered by (3).
   
   ## Verified separately
   
   No route in the 109 swept redirects unexpectedly, renders blank, overflows 
horizontally at desktop width, or leaves a spinner stuck. The four above are 
the only failures found.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to