Skip to content

Commit

Permalink
Fix missing full text search cancellation #977 (#978)
Browse files Browse the repository at this point in the history
Signed off by @danielzgtg
  • Loading branch information
danielzgtg authored Mar 12, 2023
1 parent f5c749a commit d52c5d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions www/js/lib/zimArchive.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ define(['zimfile', 'zimDirEntry', 'util', 'uiUtil', 'utf8'],
search.scanCount = 0;
// Launch a full-text search if possible
if (LZ) that.findDirEntriesFromFullTextSearch(search, dirEntries).then(function (fullTextDirEntries) {
// If user initiated a new search, cancel this one
// In particular, do not set the search status back to 'complete'
// as that would cause outdated results to unexpectedly pop up
if (search.status === 'cancelled') return callback([], search);
dirEntries = fullTextDirEntries;
search.status = 'complete';
callback(dirEntries, search);
Expand Down

0 comments on commit d52c5d5

Please sign in to comment.