chore(format): run prettier over src/ and scripts/
Formatting was configured but never enforced: `bun run format:check` reported 199 unformatted files and ran in no workflow and in no git hook, so .prettierrc (printWidth 100, trailing commas) described an intention rather than the tree. This is the one-time sweep that makes the check gateable. Whitespace and token-reflow only -- no behavioural change: `bun run check` reports 0 errors and all 1053 frontend tests pass before and after. Kept out of every other commit on purpose. A 199-file diff mixed with real changes is unreviewable, and the next commit turns format:check into a hard CI gate so this cannot silently accumulate again.
This commit is contained in:
+38
-38
@@ -5,18 +5,18 @@
|
||||
* TRACES: UR-004, UR-011 | DR-006, DR-015
|
||||
*/
|
||||
|
||||
import { commands } from '$lib/api/bindings';
|
||||
import type { CacheConfig } from '$lib/api/bindings';
|
||||
import { auth } from '$lib/stores/auth';
|
||||
import { createLogger } from '$lib/utils/logger';
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import type { CacheConfig } from "$lib/api/bindings";
|
||||
import { auth } from "$lib/stores/auth";
|
||||
import { createLogger } from "$lib/utils/logger";
|
||||
|
||||
const log = createLogger('Preload');
|
||||
const log = createLogger("Preload");
|
||||
|
||||
interface PreloadOptions {
|
||||
/** Enable debug logging */
|
||||
debug?: boolean;
|
||||
/** Override user ID (defaults to current session user) */
|
||||
userId?: string;
|
||||
/** Enable debug logging */
|
||||
debug?: boolean;
|
||||
/** Override user ID (defaults to current session user) */
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,51 +24,51 @@ interface PreloadOptions {
|
||||
* This should be called after playback starts or advances to the next track
|
||||
*/
|
||||
export async function preloadUpcomingTracks(options: PreloadOptions = {}): Promise<void> {
|
||||
const { debug = false, userId: overrideUserId } = options;
|
||||
const { debug = false, userId: overrideUserId } = options;
|
||||
|
||||
try {
|
||||
// Get current user ID
|
||||
const userId = overrideUserId || auth.getUserId();
|
||||
try {
|
||||
// Get current user ID
|
||||
const userId = overrideUserId || auth.getUserId();
|
||||
|
||||
if (!userId) {
|
||||
if (debug) log.debug('No active user session, skipping preload');
|
||||
return;
|
||||
}
|
||||
if (!userId) {
|
||||
if (debug) log.debug("No active user session, skipping preload");
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug) log.debug('Triggering preload for user:', userId);
|
||||
if (debug) log.debug("Triggering preload for user:", userId);
|
||||
|
||||
// downloadBasePath is currently unused in the backend
|
||||
const result = await commands.playerPreloadUpcoming(userId, '/downloads');
|
||||
// downloadBasePath is currently unused in the backend
|
||||
const result = await commands.playerPreloadUpcoming(userId, "/downloads");
|
||||
|
||||
if (debug) {
|
||||
log.debug('Result:', {
|
||||
queued: result.queuedCount,
|
||||
alreadyDownloaded: result.alreadyDownloaded,
|
||||
skipped: result.skipped
|
||||
});
|
||||
}
|
||||
if (debug) {
|
||||
log.debug("Result:", {
|
||||
queued: result.queuedCount,
|
||||
alreadyDownloaded: result.alreadyDownloaded,
|
||||
skipped: result.skipped,
|
||||
});
|
||||
}
|
||||
|
||||
// Log meaningful results
|
||||
if (result.queuedCount > 0) {
|
||||
log.debug(`Queued ${result.queuedCount} track(s) for background download`);
|
||||
}
|
||||
} catch (error) {
|
||||
// Fail silently - preloading is a background optimization
|
||||
// Don't interrupt the user's playback experience
|
||||
log.warn('Failed to preload upcoming tracks:', error);
|
||||
}
|
||||
// Log meaningful results
|
||||
if (result.queuedCount > 0) {
|
||||
log.debug(`Queued ${result.queuedCount} track(s) for background download`);
|
||||
}
|
||||
} catch (error) {
|
||||
// Fail silently - preloading is a background optimization
|
||||
// Don't interrupt the user's playback experience
|
||||
log.warn("Failed to preload upcoming tracks:", error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update smart cache configuration
|
||||
*/
|
||||
export async function updateCacheConfig(config: CacheConfig): Promise<void> {
|
||||
await commands.playerSetCacheConfig(config);
|
||||
await commands.playerSetCacheConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current cache configuration
|
||||
*/
|
||||
export async function getCacheConfig(): Promise<CacheConfig> {
|
||||
return await commands.playerGetCacheConfig();
|
||||
return await commands.playerGetCacheConfig();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user