Skip to content

Commit 1d70134

Browse files
committed
fix recent search bug
1 parent 84048dc commit 1d70134

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

aqmh.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,19 @@ $(() => {
374374
app.performSearch(key, type);
375375
// save to recent searches
376376
let data = [];
377+
const search = {key: key, type: type};
377378
if (localStorage.recent_search) {
379+
if (localStorage.recent_search.indexOf(JSON.stringify(search)) != -1) {
380+
return;
381+
}
378382
try {
379383
data = JSON.parse(localStorage.recent_search);
380384
} catch (e) {
381385
}
382386
}
383-
const search = {key: key, type: type};
384-
if (localStorage.recent_search.indexOf(JSON.stringify(search)) == -1) {
385-
data.push(search);
386-
while (data.length > 5) {
387-
data.shift();
388-
}
387+
data.push(search);
388+
while (data.length > 5) {
389+
data.shift();
389390
}
390391
localStorage.recent_search = JSON.stringify(data);
391392
app.loadRecent();

www/js/aqmh.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)