all repos — searchix @ 628c2a858191cde34478b760b3c8c6c23a420088

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: js error when no results found
Alan Pearce alan@alanpearce.eu
Sun, 12 May 2024 12:49:47 +0200
commit

628c2a858191cde34478b760b3c8c6c23a420088

parent

6ea867dfa9043e9f9beedaabc195a2657254bdc8

1 files changed, 6 insertions(+), 2 deletions(-)

jump to
M frontend/static/search.jsfrontend/static/search.js
@@ -56,8 +56,12 @@ results = fragment.querySelector("#results");   pagination = fragment.querySelector("#pagination");
   range.deleteContents();
   range.insertNode(fragment);
-  addToggleEventListeners(results);
-  addPaginationEventListeners(pagination);
+  if (results !== null) {
+    addToggleEventListeners(results);
+  }
+  if (pagination !== null) {
+    addPaginationEventListeners(pagination);
+  }
 }
 
 function getResults(url) {