perf: fix issues #1,#2,#3,#13 from performance audit
- #1 image_transcode: dedicated rayon pool + moka cache (no tokio blocking) - #2 ltree materialized paths: eliminate N+1 folder/file queries - #3 compute_content_hash: read blob_hash column instead of loading file into RAM - #13 event delegation + DocumentFragment: ~15 delegated listeners replace ~19k per-item listeners Backend: 82/82 tests pass, cargo check clean. Frontend: ui.js and app.js syntax-validated via Node.js.
This commit is contained in:
+3
-7
@@ -788,6 +788,7 @@ async function loadFiles(options = {}) {
|
||||
|
||||
// Clear existing files in both views
|
||||
if (window.multiSelect) window.multiSelect.clear();
|
||||
ui._items.clear();
|
||||
elements.filesGrid.innerHTML = '';
|
||||
elements.filesListView.innerHTML = `
|
||||
<div class="list-header">
|
||||
@@ -815,9 +816,7 @@ async function loadFiles(options = {}) {
|
||||
|
||||
// Backend already scopes folders to the authenticated user,
|
||||
// so no client-side filtering is needed.
|
||||
folderList.forEach(folder => {
|
||||
ui.addFolderToView(folder);
|
||||
});
|
||||
ui.renderFolders(folderList);
|
||||
|
||||
// Also load files in this folder
|
||||
const cacheTimestamp = new Date().getTime();
|
||||
@@ -846,10 +845,7 @@ async function loadFiles(options = {}) {
|
||||
const fileList = Array.isArray(files) ? files : [];
|
||||
console.log(`Processing ${fileList.length} files`);
|
||||
|
||||
fileList.forEach(file => {
|
||||
console.log(`Adding file to view: ${file.name} (${file.id})`);
|
||||
ui.addFileToView(file);
|
||||
});
|
||||
ui.renderFiles(fileList);
|
||||
} else {
|
||||
const errorText = await filesResponse.text();
|
||||
console.error(`Error loading files: ${filesResponse.status} - ${errorText}`);
|
||||
|
||||
Reference in New Issue
Block a user