Skip to content

Commit

Permalink
Fix "no results" shown when starting new search while searching
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfactotum committed May 12, 2023
1 parent 9b0a5bf commit f386780
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/foliate-js
Submodule foliate-js updated 7 files
+4 −0 comic-book.js
+10 −3 epub.js
+5 −0 fb2.js
+9 −1 fixed-layout.js
+7 −0 mobi.js
+6 −1 paginator.js
+5 −0 view.js
8 changes: 5 additions & 3 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ GObject.registerClass({
this.generator = await this.getGenerator({ ...opts, query, index })

for await (const result of this.generator) {
if ('progress' in result)
if (result === 'done') {
this.entry.progress_fraction = null
if (!this.model.model.get_n_items()) this.emit('no-results')
}
else if ('progress' in result)
this.entry.progress_fraction = result.progress
else {
const { label, cfi, excerpt, subitems } = result
Expand All @@ -125,8 +129,6 @@ GObject.registerClass({
}) : new SearchResult({ label: formatExcerpt(excerpt), cfi }))
}
}
this.entry.progress_fraction = null
if (!this.model.model.get_n_items()) this.emit('no-results')
}
cycle(dir) {
const { model } = this
Expand Down

0 comments on commit f386780

Please sign in to comment.