kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Facility > Data: Generate log does nothing when clicked before the first log date loads

Open rtibblesbot opened this issue 1 week ago • 0 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: develop

Observed behavior

  • In Facility > Data, clicking Generate log (session or summary logs) before the firstlogdate response arrives raises a TypeError. The date-range dialog does not open.
  • The dialog stays closed after the response arrives, and clicking Generate log again does nothing. Reloading the page restores the button.
  • The page requests firstlogdate only after the facility list returns, so both requests have to finish before the button works.
  • #15825 resets the date when the facility id in the URL changes while the page is open; the button fails the same way until the new facility's date arrives.

Errors and logs

Browser console:

TypeError: Cannot read properties of null (reading 'getDate')
    at VueComponent.firstAllowedDate (kolibri/plugins/facility/frontend/views/DataPage/index.vue:283)

Raised by firstAllowedDate, which reads firstLogDate while it is still null.

Steps to reproduce

  1. In the browser's network tools, throttle to Slow 3G.
  2. As a facility admin, open Facility > Data.
  3. Click Generate log under Session logs as soon as the page renders.
  4. Wait for the firstlogdate request to finish, then click Generate log again.

Context

  • Kolibri develop at 758605b764.
  • Reproduced in a Jest render of DataPage with the firstlogdate response held.

Acceptance Criteria

  • [ ] Clicking either Generate log before the firstlogdate response arrives logs no TypeError.
  • [ ] Once the response has arrived, clicking either Generate log opens the date-range dialog, whether or not it was clicked earlier.
  • [ ] Both hold after the facility changes while the page stays open.
  • [ ] A Jest spec holds the firstlogdate response, clicks Generate log, releases the response, and checks both.

AI usage

Claude Code found this while working on #13260, reproduced it in a Jest render of DataPage, and drafted this issue.

rtibblesbot avatar Nov 24 '26 13:11 rtibblesbot