Aman-Mittal opened a new pull request, #546:
URL: https://github.com/apache/fineract-backoffice-ui/pull/546

   ## What changed
   
   - hold the client form's three `ion-datetime-button` elements back one 
render, behind an `@if (pickersReady())` fed by `afterNextRender`
   - add an e2e spec that walks a full client create and then reopens the form, 
asserting every date button still renders a date
   
   Picker IDs are unchanged.
   
   ## Why
   
   `ion-datetime-button` resolves its target `ion-datetime` exactly once, in 
`componentWillLoad`, through a global `getElementById`, and gives up for good 
when that lookup misses. The pickers it points at live inside 
`ion-modal[keepContentsMounted]`, whose contents Angular mounts later in the 
change-detection pass.
   
   On a first visit the button's lazy Ionic chunk is still loading, which 
delays it past that point. On a revisit the chunk is cached, so the button 
initializes first, finds nothing, and renders a blank control that never opens 
— no way to enter submitted-on, activation or date-of-birth. Deferring the 
buttons one render puts the pickers in the DOM before the buttons look for them.
   
   Worth recording, since it is the natural first guess: this is not an ID 
collision. When the second form fails, the document holds exactly one 
`app-client-form` and one of each picker — the previous form is fully destroyed 
before the new one mounts. Making the IDs unique per instance does not fix it; 
the button then bails on its *first* guard instead (`An ID associated with an 
ion-datetime instance is required to function properly`), because a 
`[datetime]` property binding is not yet applied at `componentWillLoad`. The 
control stays blank either way. More detail in #544.
   
   ## Testing
   
   Reproduced and verified in a real browser, both directions:
   
   - with the fix, the reopened form renders `Sep 12, 2026` on every button and 
logs no Ionic errors
   - with the component change stashed, the new spec fails with exactly the 
errors from the issue:
     ```
     [ion-datetime-button] - No ion-datetime instance found for ID 
'submittedOnDate-picker'
     [ion-datetime-button] - No ion-datetime instance found for ID 
'activationDate-picker'
     ```
   
   The spec reads the button's shadow root rather than its `textContent`, which 
is always empty and cannot tell a bound control from a dead one.
   
   Also run: `npx playwright test client-date-picker-revisit --project=mocked`, 
`npm run typecheck:e2e`, `prettier --check`.
   
   ## Follow-ups, not in this PR
   
   - The same pattern appears in 97 `ion-datetime-button` usages across 62 
components, so any revisited form page has this bug. This PR fixes the reported 
one; the rest deserve their own change.
   - Picker ID names are shared across files (`transactionDate-picker` in 8, 
`submittedOnDate-picker` in 7). Two such pages alive at once would collide. 
Latent today, but worth making unique — see #544.
   
   Fixes #541


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