Skip to content

Commit

Permalink
refactor: manage single popover instance
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Shandilya <[email protected]>
  • Loading branch information
void-hr committed Oct 11, 2024
1 parent f9debcd commit 02b189d
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions assets/js/offline-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,13 @@
//
// Dispose existing popover
//

{
let popover = bootstrap.Popover.getInstance($targetSearchInput[0]);
if (popover !== null) {
popover.dispose();
}
}

bootstrap.Popover.getInstance($targetSearchInput[0])?.dispose();
//
// Search
//

if (idx === null) {
return;
}

const searchQuery = $targetSearchInput.val();
if (searchQuery === "") {

if (idx === null || searchQuery === "") {
return;
}

Expand Down

0 comments on commit 02b189d

Please sign in to comment.