mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
fix(settings): show excluding state on library index exclude action
Flush UI before the async unbind, disable repeat clicks, cancel an active sync when needed, and label the button "Excluding…" / localized equivalent.
This commit is contained in:
@@ -62,6 +62,25 @@ function waitForServerIdle(serverId: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
/** Wait until a server emits `library:sync-idle`, or time out (best-effort). */
|
||||
export function waitForLibrarySyncIdle(serverId: string, timeoutMs = 15_000): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
let unlisten: (() => void) | undefined;
|
||||
const timer = setTimeout(() => {
|
||||
unlisten?.();
|
||||
resolve();
|
||||
}, timeoutMs);
|
||||
void subscribeLibrarySyncIdle(p => {
|
||||
if (p.serverId !== serverId) return;
|
||||
clearTimeout(timer);
|
||||
unlisten?.();
|
||||
resolve();
|
||||
}).then(fn => {
|
||||
unlisten = fn;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function invokeSync(serverId: string, kind: LibrarySyncQueueKind): Promise<void> {
|
||||
if (kind === 'verify') {
|
||||
await librarySyncVerifyIntegrity({ serverId });
|
||||
|
||||
Reference in New Issue
Block a user