fix(ui): resolve dark mode toggle and file search errors

- Fix dark mode toggle not responding by deriving theme state from
  localStorage instead of UI pill state. Added syncThemePill() to ensure
  UI and document theme stay synchronized.

- Fix file search error when folder_id is empty by validating the
  currentPath before setting it in search options. Empty folder_id
  now correctly triggers global search instead of causing a backend
  error with invalid UUID.

Fixes #102
This commit is contained in:
BillionClaw
2026-03-17 14:19:09 +08:00
parent b7e3fb13f5
commit 91e907bef6
2 changed files with 50 additions and 16 deletions
+7 -3
View File
@@ -27,12 +27,16 @@ async function performSearch(query, sortBy) {
};
if (!app.isTrashView) {
options.folder_id = app.currentPath;
if (!options.folder_id || options.folder_id === '') {
// Ensure we have a valid folder_id before searching
if (!app.currentPath || app.currentPath === '') {
await window.resolveHomeFolder();
}
// Only set folder_id if we have a valid value
if (app.currentPath && app.currentPath !== '') {
options.folder_id = app.currentPath;
}
// If still no valid folder_id, search will be global (without folder_id)
}
const searchResults = await window.search.searchFiles(query, options);