Migrate all IPC call sites to typed tauri-specta commands.*
Replace the remaining ~155 untyped invoke() calls across stores, services, components, and routes with the generated commands.* wrappers from $lib/api/bindings, so every IPC call is compile-time-checked against the command signatures. - Register repository_get_subtitle_url and repository_get_video_download_url in specta_builder() and the invoke_handler; regenerate bindings.ts. - Source duplicated wire types (AutoplaySettings, CacheConfig, Session, ConnectivityStatus, audio/video settings, etc.) from bindings. - Fix two bugs surfaced by the typed wrappers: - VideoDownloadButton passed an un-awaited Promise as the stream URL. - setAutoplaySettings omitted the required userId argument. - Update unit tests asserting the old invoke(name, args) shape. - Remove the five param-naming guard tests; the compiler and codegen now enforce what they checked. svelte-check: 0 errors. vitest: green. cargo test --lib: green.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Favorites service - Handles toggling favorite status with optimistic updates
|
||||
// TRACES: UR-017 | DR-021
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import { auth } from "$lib/stores/auth";
|
||||
|
||||
/**
|
||||
@@ -29,11 +29,7 @@ export async function toggleFavorite(
|
||||
const newIsFavorite = !currentIsFavorite;
|
||||
|
||||
// 1. Update local database first (optimistic update)
|
||||
await invoke("storage_toggle_favorite", {
|
||||
userId,
|
||||
itemId,
|
||||
isFavorite: newIsFavorite,
|
||||
});
|
||||
await commands.storageToggleFavorite(userId, itemId, newIsFavorite);
|
||||
|
||||
// 2. Sync to Jellyfin server
|
||||
try {
|
||||
@@ -45,7 +41,7 @@ export async function toggleFavorite(
|
||||
}
|
||||
|
||||
// 3. Mark as synced
|
||||
await invoke("storage_mark_synced", { userId, itemId });
|
||||
await commands.storageMarkSynced(userId, itemId);
|
||||
} catch (error) {
|
||||
console.error("Failed to sync favorite to server:", error);
|
||||
// Favorite is stored locally and will be synced later
|
||||
|
||||
Reference in New Issue
Block a user