arpitjain099 opened a new pull request, #524:
URL: https://github.com/apache/fineract-backoffice-ui/pull/524
The route puts no constraint on `:variationId`, so `edit/abc` gave `+'abc'`
and left `variationId` as `NaN`. `isEditMode` was set from the presence of the
segment, but `loadPause` and the save branch both test the id itself, and `NaN`
is falsy. The screen therefore said Edit Interest Pause, the pickers sat on
today, and Save posted a create. Nothing on screen said so, which is the part
that makes it worth fixing rather than leaving to the API.
`toRouteId` now parses the segment and returns null for anything that cannot
be a pause id: non-numeric, empty, zero, negative, fractional. An id that fails
that check sends the user back to `/loans/{loanId}/interest-pauses`, the same
place Cancel and a successful save go. That felt more honest than quietly
rendering the create form under an `/edit/` URL. If you would rather show an
error and stay put, say so and I will change it.
The same helper reads `loanId`, so a non-numeric loan id no longer produces
`NaN` there either.
Five parameterized cases in the existing spec cover `abc`, `0`, `-1`, `1.5`
and a blank segment, asserting edit mode stays off, no pause fetch is issued
and the navigation happens. Against the current component all five fail:
src/app/features/loans/interest-pauses/interest-pause-form.component.test.ts
(10 tests | 5 failed)
and they pass with the change.
The full `ng run fineract-backoffice-ui:unit-test` run has pre-existing
failures in `web-storage.adapter`, `auth.service`, `config.service`,
`institution-config.service`, `navigation-config.service`, `client-form` and
`has-institution-feature.directive`. They fail the same way on `main` without
this branch, and the count moves a little between runs, so they look
environment-dependent rather than related. `interest-pause-form` is not among
them either way. Prettier is clean on both changed files.
Closes #512
--
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]