fix: 侧边栏watcher泄漏、目录刷新防抖、清理过时注释
This commit is contained in:
@@ -1263,8 +1263,11 @@
|
||||
|
||||
btnOpenFolder.addEventListener('click', openFolder);
|
||||
if (typeof window.electronAPI !== 'undefined') {
|
||||
let dirRefreshTimer = null;
|
||||
window.electronAPI.onDirChanged(() => {
|
||||
if (currentRootPath) refreshTree();
|
||||
if (!currentRootPath) return;
|
||||
if (dirRefreshTimer) clearTimeout(dirRefreshTimer);
|
||||
dirRefreshTimer = setTimeout(() => refreshTree(), 300);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1275,7 +1278,6 @@
|
||||
}
|
||||
|
||||
async function openFolderDialog() {
|
||||
// We'll add a dir:openDialog IPC
|
||||
if (typeof window.electronAPI !== 'undefined' && window.electronAPI.openFolderDialog) {
|
||||
const result = await window.electronAPI.openFolderDialog();
|
||||
if (result) {
|
||||
|
||||
Reference in New Issue
Block a user