feat: Update restoreSelectedFolder to ensure activeFolder is a string before assignment and reset selectedPath if not

This commit is contained in:
Will Miao
2025-08-29 17:46:43 +08:00
parent 975ff2672d
commit f64597afd2
2 changed files with 2 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -754,12 +754,13 @@ export class SidebarManager {
restoreSelectedFolder() { restoreSelectedFolder() {
const activeFolder = getStorageItem(`${this.pageType}_activeFolder`); const activeFolder = getStorageItem(`${this.pageType}_activeFolder`);
if (activeFolder) { if (activeFolder && typeof activeFolder === 'string') {
this.selectedPath = activeFolder; this.selectedPath = activeFolder;
this.updateTreeSelection(); this.updateTreeSelection();
this.updateBreadcrumbs(); this.updateBreadcrumbs();
this.updateSidebarHeader(); this.updateSidebarHeader();
} else { } else {
this.selectedPath = '';
this.updateSidebarHeader(); this.updateSidebarHeader();
this.updateBreadcrumbs(); // Always update breadcrumbs this.updateBreadcrumbs(); // Always update breadcrumbs
} }