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

   ## What happens
   
   `/organization/offices` on a tenant with exactly one office renders:
   
   ```
   1 - 1 of many
   ```
   
   There is provably nothing beyond that single record — the table shows one 
row, "Head Office", and the entire dataset is already client-side.
   
   ![Offices list showing a single Head Office row with the footer reading "1 - 
1 of 
many"](https://raw.githubusercontent.com/Aman-Mittal/fineract-backoffice-ui/assets/issue-screenshots/offices-pagination-of-many.png)
   
   ## Cause
   
   `src/app/shared/components/paginator/paginator.component.ts`'s `rangeLabel` 
computed applies a deliberate sentinel:
   
   ```ts
   if (length % pageSize === 1) return '... of many';
   ```
   
   The intent is documented in the code and is sound: Fineract sometimes 
reports a total that is exactly one record past the current page as a signal 
for "there is at least one more", not as a literal count, so the paginator 
hedges rather than printing a number it does not trust.
   
   The problem is that the hedge fires unconditionally, including where there 
is nothing to hedge:
   
   - `offices-list.component.ts:52` sets `[localLogic]="true"`, and `pageSize` 
defaults to `10`.
   - `data-table.component.ts:461` passes `resolved().length` straight through 
as `totalRecords`.
   - With one office, `1 % 10 === 1` → the sentinel trips.
   
   In `localLogic` mode the component already holds the **complete array** in 
memory. The length is an exact count by construction, not a Fineract pagination 
artifact, so there is no ambiguity for the sentinel to protect against.
   
   ## Scope
   
   This is not a one-record edge case. It misfires on any total of the form 
`k·pageSize + 1` — 1, 11, 21, 101 records at the default page size — and it 
affects every screen backed by a Fineract endpoint that returns a bare array 
rather than a `{ totalFilteredRecords, pageItems }` wrapper. Offices and Staff 
are confirmed; the reference-data lists (Currencies, Payment Types, Group 
Levels, and similar) are built the same way.
   
   Genuinely server-paginated screens — Clients, Users, Reports — are 
unaffected and correctly show real counts.
   
   ## Suggested fix
   
   Let the paginator know when the total is exact. Add an input (default 
`false`, preserving today's behaviour for server-paginated screens) that 
suppresses the sentinel, and have `DataTableComponent` pass `localLogic()` into 
it — so every `[localLogic]="true"` screen gets a real number while the 
Fineract hedge stays in place exactly where it is needed.
   
   The sentinel should apply only when the total came from a genuinely 
paginated server response, never when the full dataset is already in memory.
   
   ## Environment
   
   Reproduced against a clean checkout of `main` (`a24a06ba`) served with `ng 
serve`, backend `sandbox.mifos.community`, 1366×900, Chrome. `GET /offices` 
returns a bare array with one element.
   


-- 
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