Search fix.
This commit is contained in:
parent
f82079ff27
commit
b8d30af69e
@ -18,7 +18,9 @@ export class FileList extends HTMLElement {
|
||||
this.addEventListener('click', this.boundHandleClick);
|
||||
this.addEventListener('dblclick', this.boundHandleDblClick);
|
||||
this.addEventListener('change', this.boundHandleChange);
|
||||
await this.loadContents(null);
|
||||
if (!this.hasAttribute('data-search-mode')) {
|
||||
await this.loadContents(null);
|
||||
}
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
|
||||
@ -28,6 +28,7 @@ export class RBoxApp extends HTMLElement {
|
||||
this.navigationStack = [];
|
||||
this.boundHandlePopState = this.handlePopState.bind(this);
|
||||
this.popstateAttached = false;
|
||||
this.currentSearchId = 0;
|
||||
}
|
||||
|
||||
async connectedCallback() {
|
||||
@ -567,8 +568,10 @@ export class RBoxApp extends HTMLElement {
|
||||
}
|
||||
|
||||
async performSearch(query) {
|
||||
const searchId = ++this.currentSearchId;
|
||||
try {
|
||||
const files = await api.searchFiles(query);
|
||||
if (searchId !== this.currentSearchId) return;
|
||||
const mainContent = this.querySelector('#main-content');
|
||||
mainContent.innerHTML = `
|
||||
<div class="search-results">
|
||||
@ -580,7 +583,9 @@ export class RBoxApp extends HTMLElement {
|
||||
fileList.setFiles(files);
|
||||
this.attachListeners();
|
||||
} catch (error) {
|
||||
console.error('Search failed:', error);
|
||||
if (searchId === this.currentSearchId) {
|
||||
console.error('Search failed:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user