shivaansh0610-LUFFY opened a new pull request, #621:
URL: https://github.com/apache/fineract-backoffice-ui/pull/621
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- Commits must be signed to merge — see CONTRIBUTING.md#commit-signing if
you haven't set this up. -->
## Summary
Fixes the Savings Accounts paginator displaying `NaN` when loading account
data.
Closes #620
## Root Cause
The generated OpenAPI client types `pageItems` as `Set<GetSavingsPageItems>`
because the API specification marks the field as `uniqueItems: true`.
However, the actual JSON response contains `pageItems` as a plain array. As
a result, `response.pageItems.size` type-checks against the generated
TypeScript type but evaluates to `undefined` at runtime. This causes the
paginator calculation to produce `NaN`.
## Fix
Reuse the existing `Array.from(...)` conversion to obtain a real array
before filtering and pagination calculations.
The paginator now compares the length of the converted array with the
filtered result, avoiding reliance on the incorrect runtime `Set` assumption.
A regression test suite was also added to cover normal results, client-side
filtering, and empty pages.
## Verification
* `npm run lint`
* `npm run test:unit` — 1570/1570 tests passing
* `npm run build`
* Reproduced the issue on the real development server using a mocked backend.
* Verified the paginator changes from `1 - 10 of NaN` to `1 - 3 of 3`.
* Added regression coverage for:
* all returned rows surviving the client-side deposit-type filter
* rows being removed by the deposit-type filter
* an empty page returning `0` instead of `NaN`
## Screenshots & Recordings
### Before
Paginator displays `1 - 10 of NaN`.
<img width="1280" height="800" alt="savings-accounts-before"
src="https://github.com/user-attachments/assets/6da1e572-80c9-4429-b00d-e5061f03deb6"
/>
[[savings-accounts-before.webm](https://github.com/user-attachments/assets/ace982d9-6880-43dc-81fc-686da7b308f7)](https://github.com/user-attachments/assets/ace982d9-6880-43dc-81fc-686da7b308f7)
### After
Paginator correctly displays `1 - 3 of 3`.
<img width="1280" height="800" alt="savings-accounts-after"
src="https://github.com/user-attachments/assets/6d22ef54-2fdc-4686-bd85-4ab846e1b139"
/>
[[savings-accounts-after.webm](https://github.com/user-attachments/assets/e4181833-534a-4e2f-8189-0278bd01dd98)](https://github.com/user-attachments/assets/e4181833-534a-4e2f-8189-0278bd01dd98)
Screenshots and recordings were captured against a mocked backend on the
real development server.
## AI Assistance
<!-- If generative AI materially assisted this contribution, optionally
state the tool or model and
the harness or workflow used. The contributor remains responsible for the
submitted change. -->
* Tool / model: Claude Sonnet 5
* Harness / workflow: Interactive code review, debugging, test review, and
PR drafting in VS Code
## Checklist
<!-- Check each item, or explain why it does not apply. -->
* [x] I did not hand-edit generated files under `src/app/api/`.
* [ ] New component or service code uses the adapter boundary in
`src/app/core/adapters/` instead of direct browser globals or imperative
third-party APIs. Not applicable — no new component or service code was added.
* [x] User-facing strings use translation keys.
* [x] I added or updated tests appropriate to this change, or explained why
tests were not needed.
* [ ] UI workflow changes include suitable e2e coverage, including
real-backend testing where relevant. Unit regression coverage and mocked
dev-server UI verification were added; no new e2e test was added.
* [ ] Commits are signed — see [[Commit
Signing](https://chatgpt.com/c/CONTRIBUTING.md#commit-signing)](CONTRIBUTING.md#commit-signing)
in CONTRIBUTING.md.
* [x] I followed the [[AI-assisted contributions
guidance](https://chatgpt.com/c/CONTRIBUTING.md#ai-assisted-contributions)](CONTRIBUTING.md#ai-assisted-contributions).
--
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]