Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ public/codemirror-bundle.js
.env
.cache/
dev-app-update.yml

# Scratch space (Skaleet workspace convention)
.work-files/

1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const rendererCrossFileGlobals = {
renderMemories: 'readonly',
loadWorkFiles: 'readonly',
renderWorkFiles: 'readonly',
removeWorkFileFromCache: 'readonly',
openWorkFile: 'readonly',
clearNotifications: 'readonly',
setSessionMcpActive: 'readonly',
Expand Down
6 changes: 4 additions & 2 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ const workFilesPanel = new ViewerPanel(workFilesViewer, {
onDelete: async (filePath) => {
const result = await window.api.deleteWorkFile(filePath);
if (result && result.ok) {
// Hide the panel and reload the list
// Hide the panel and surgically remove the entry from the cached list.
// We avoid loadWorkFiles() because the full disk re-scan can freeze the
// UI on projects with large .work-files/ trees (e.g. tagpay = 39k files).
workFilesViewer.style.display = 'none';
if (typeof loadWorkFiles === 'function') loadWorkFiles();
if (typeof removeWorkFileFromCache === 'function') removeWorkFileFromCache(filePath);
}
return result;
},
Expand Down
16 changes: 16 additions & 0 deletions public/plans-memory-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,22 @@ async function loadWorkFiles() {
renderWorkFiles();
}

// Remove a single deleted file from the in-memory model and re-render.
// Avoids re-running the (sometimes slow) full disk scan in get-work-files.
function removeWorkFileFromCache(filePath) {
for (const proj of cachedWorkFilesData) {
const idx = proj.files.findIndex(f => f.filePath === filePath);
if (idx !== -1) {
proj.files.splice(idx, 1);
if (typeof proj.totalCount === 'number') proj.totalCount = Math.max(0, proj.totalCount - 1);
break;
}
}
// Drop projects that no longer have files
cachedWorkFilesData = cachedWorkFilesData.filter(p => p.files.length > 0);
renderWorkFiles();
}

function renderWorkFiles(filterIds) {
workFilesContent.innerHTML = '';
if (cachedWorkFilesData.length === 0) {
Expand Down
Loading