From ae3fd5591f76f3438b29e30330dd4a071101a1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=A4is=C3=A4?= Date: Thu, 16 Apr 2026 11:22:20 +0300 Subject: [PATCH] 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 Signed-off-by: Jan Kissig Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/prog/js/holds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 6ae9ab1072..2dd163ef2e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -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 () {