Bug 42343: Prevent holds JS error when no holds exist

In the holds view, opening a record with no existing holds can leave
holdsQueueTable undefined while follow-up code still calls api() on it.

This triggers a Firefox console error:

  Uncaught (in promise) TypeError: can't access property "api", holdsQueueTable is undefined

Test plan:
1. Navigate to a title that has no existing holds.
2. Confirm no holdsQueueTable undefined error is logged.
3. Navigate to a title that has existing holds.
4. Confirm the holds queue still loads normally.
5. Confirm hold actions that refresh the queue still work as expected.

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Johanna Räisä 2026-04-16 11:22:20 +03:00 committed by Lucas Gass
parent d71a40dc9d
commit ae3fd5591f
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 1 additions and 1 deletions

View File

@ -1847,7 +1847,7 @@ async function load_patron_holds_table(biblio_id, split_data) {
},
hold_table_settings
);
holdsQueueTable.api().page(0).draw(false);
// Clear selectedHolds on page load
localStorage.removeItem("selectedHolds");
$(table_id).on("draw.dt", function () {