Morrowga opened a new pull request, #556:
URL: https://github.com/apache/fineract-backoffice-ui/pull/556

   Fixes #555
   
   ## The bug
   
   `IdleService.showInactivityWarning()` calls `dialogService.present()` and 
only assigns
   `this.dialogRef` once that promise resolves. But `presentModal()` in
   `ionic-overlay.adapter.ts` resolves only after Ionic's own enter animation 
finishes
   (~300ms+, per that file's own comment)  not the instant the modal is created.
   
   If the session ends for an unrelated reason during that window — a 401 from 
another tab,
   an explicit sign-out `closeDialog()` runs while `dialogRef` is still `null` 
and has
   nothing to dismiss. The warning dialog still appears moments later, even 
though the
   session it's warning about is already gone.
   
   ## The fix
   
   Check `authService.isAuthenticated()` at the first moment a real handle 
actually exists
   (inside the `.then()` callback), and immediately dismiss the modal instead 
of treating it
   as a live warning, when the session has already ended by that point.
   
   ## Testing
   
   Added a test using the same deferred-promise pattern the existing
   `'keeps the hard logout timer running when activity is reported while the 
warning is
   still being presented'` test already uses to simulate this exact async gap  
just
   triggered by the session ending instead of an activity event.
   
   Confirmed via `git stash` that the new test fails on the prior code with a 
precise
   assertion failure (`expected "vi.fn()" to be called at least once`), not a 
type error —
   and passes with the fix.
   
   Full local check suite, all green:
   - `npx tsc --noEmit`
   - `npm run lint`
   - `npm run format:check`
   - `npm test -- --watch=false` 241/241 files, 1466/1466 tests
   - `npm run check:icons`
   - `npm run i18n:check`
   - `./scripts/check-license.sh`
   - `npm run build`
   
   ## What I didn't do
   
   This fixes the specific race described in #555. I did not audit 
`closeDialog()`'s other
   callers or the broader `presentModal()` contract for similar async-gap 
issues elsewhere
   in the app , this PR is scoped to the inactivity dialog only.


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