fix(frontend): sync sidebar pause menu with per-worker background task state
github/actions/ci GitHub Actions CI finished: success

Only require a worker to be paused if it currently has pending work for
that folder, instead of demanding all four worker flags be true. The
background tasks panel only lets you toggle stages it shows, so the old
check stayed out of sync after pausing everything visible.

Also grants start-dragging and start-resize-dragging window permissions.
This commit is contained in:
2026-07-06 00:47:13 +01:00
parent dcc1612802
commit b8d009c973
2 changed files with 28 additions and 10 deletions
+7 -3
View File
@@ -2,7 +2,9 @@
"$schema": "../gen/schemas/desktop-schema.json", "$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default", "identifier": "default",
"description": "Capability for the main window", "description": "Capability for the main window",
"windows": ["main"], "windows": [
"main"
],
"permissions": [ "permissions": [
"core:default", "core:default",
"opener:default", "opener:default",
@@ -19,6 +21,8 @@
"core:window:allow-minimize", "core:window:allow-minimize",
"core:window:allow-close", "core:window:allow-close",
"core:window:allow-toggle-maximize", "core:window:allow-toggle-maximize",
"core:window:allow-is-maximized" "core:window:allow-is-maximized",
"core:window:allow-start-dragging",
"core:window:allow-start-resize-dragging"
] ]
} }
+21 -7
View File
@@ -39,14 +39,28 @@ export function FolderItem({
const mutedFolderIds = useGalleryStore((state) => state.mutedFolderIds) const mutedFolderIds = useGalleryStore((state) => state.mutedFolderIds)
const setAllWorkersPaused = useGalleryStore((state) => state.setAllWorkersPaused) const setAllWorkersPaused = useGalleryStore((state) => state.setAllWorkersPaused)
const folderWorkers = useGalleryStore((state) => state.workerPaused[folder.id]) const folderWorkers = useGalleryStore((state) => state.workerPaused[folder.id])
const folderJobs = useGalleryStore((state) => state.mediaJobProgress[folder.id])
const isMuted = mutedFolderIds.includes(folder.id) const isMuted = mutedFolderIds.includes(folder.id)
// "Fully paused" only when every worker for this folder is paused. // "Fully paused" means every worker that currently has pending work is
const isPausedAll = // paused. Workers with nothing pending are ignored — the background tasks
!!folderWorkers && // panel only lets you toggle the stages it actually shows, so requiring
folderWorkers.thumbnail && // every worker key to be literally true left this permanently out of sync
folderWorkers.metadata && // (menu kept offering "Pause" after the visible work was already paused).
folderWorkers.embedding && const hasPendingWork =
folderWorkers.tagging (folderJobs?.thumbnail_pending ?? 0) > 0 ||
(folderJobs?.metadata_pending ?? 0) > 0 ||
(folderJobs?.embedding_pending ?? 0) > 0 ||
(folderJobs?.tagging_pending ?? 0) > 0
const isPausedAll = hasPendingWork
? ((folderJobs?.thumbnail_pending ?? 0) === 0 || !!folderWorkers?.thumbnail) &&
((folderJobs?.metadata_pending ?? 0) === 0 || !!folderWorkers?.metadata) &&
((folderJobs?.embedding_pending ?? 0) === 0 || !!folderWorkers?.embedding) &&
((folderJobs?.tagging_pending ?? 0) === 0 || !!folderWorkers?.tagging)
: !!folderWorkers &&
folderWorkers.thumbnail &&
folderWorkers.metadata &&
folderWorkers.embedding &&
folderWorkers.tagging
const isIndexing = progress && !progress.done const isIndexing = progress && !progress.done
const isMissing = !!folder.scan_error && !isIndexing const isMissing = !!folder.scan_error && !isIndexing