mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Lazy Loading fuse-worker and fixed some potential timing issues
Fixes #1489 Fixes #1463 Co-Authored-By: Taloth <Taloth@users.noreply.github.com>
This commit is contained in:
parent
8453c5ef04
commit
de830b9c1f
3 changed files with 114 additions and 42 deletions
|
@ -3,9 +3,9 @@ import Fuse from 'fuse.js';
|
|||
const fuseOptions = {
|
||||
shouldSort: true,
|
||||
includeMatches: true,
|
||||
ignoreLocation: true,
|
||||
threshold: 0.3,
|
||||
location: 0,
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
keys: [
|
||||
'artistName',
|
||||
|
@ -47,7 +47,7 @@ function getSuggestions(artists, value) {
|
|||
return suggestions;
|
||||
}
|
||||
|
||||
self.addEventListener('message', (e) => {
|
||||
onmessage = function(e) {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
@ -57,5 +57,12 @@ self.addEventListener('message', (e) => {
|
|||
value
|
||||
} = e.data;
|
||||
|
||||
self.postMessage(getSuggestions(artists, value));
|
||||
});
|
||||
const suggestions = getSuggestions(artists, value);
|
||||
|
||||
const results = {
|
||||
value,
|
||||
suggestions
|
||||
};
|
||||
|
||||
self.postMessage(results);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue