Many improvemtns and fixes related to decoupling of svelte and rust on android.
🏗️ Build and Test JellyTau / Run Tests (push) Failing after 18s
🏗️ Build and Test JellyTau / Build Android APK (push) Has been skipped
Traceability Validation / Check Requirement Traces (push) Failing after 2s

This commit is contained in:
2026-02-28 19:50:47 +01:00
parent 07f3bf04ca
commit e8e37649fa
53 changed files with 2309 additions and 792 deletions
+16 -15
View File
@@ -12,7 +12,8 @@ interface LibraryState {
currentLibrary: Library | null;
items: MediaItem[];
currentItem: MediaItem | null;
isLoading: boolean;
/** Counter for concurrent loading operations. isLoading = loadingCount > 0 */
loadingCount: number;
error: string | null;
totalItems: number;
searchQuery: string;
@@ -34,7 +35,7 @@ function createLibraryStore() {
currentLibrary: null,
items: [],
currentItem: null,
isLoading: false,
loadingCount: 0,
error: null,
totalItems: 0,
searchQuery: "",
@@ -50,7 +51,7 @@ function createLibraryStore() {
console.log("✅ [LibraryStore] Cache logging enabled - you should see cache hit/miss logs below");
async function loadLibraries() {
update((s) => ({ ...s, isLoading: true, error: null }));
update((s) => ({ ...s, loadingCount: s.loadingCount + 1, error: null }));
try {
const startTime = performance.now();
@@ -71,13 +72,13 @@ function createLibraryStore() {
update((s) => ({
...s,
libraries,
isLoading: false,
loadingCount: Math.max(0, s.loadingCount - 1),
}));
return libraries;
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to load libraries";
update((s) => ({ ...s, isLoading: false, error: message }));
update((s) => ({ ...s, loadingCount: Math.max(0, s.loadingCount - 1), error: message }));
throw error;
}
}
@@ -86,7 +87,7 @@ function createLibraryStore() {
parentId: string,
options: { startIndex?: number; limit?: number; genres?: string[] } = {}
) {
update((s) => ({ ...s, isLoading: true, error: null }));
update((s) => ({ ...s, loadingCount: s.loadingCount + 1, error: null }));
try {
const startTime = performance.now();
@@ -115,19 +116,19 @@ function createLibraryStore() {
...s,
items: result.items,
totalItems: result.totalRecordCount,
isLoading: false,
loadingCount: Math.max(0, s.loadingCount - 1),
}));
return result;
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to load items";
update((s) => ({ ...s, isLoading: false, error: message }));
update((s) => ({ ...s, loadingCount: Math.max(0, s.loadingCount - 1), error: message }));
throw error;
}
}
async function loadItem(itemId: string) {
update((s) => ({ ...s, isLoading: true, error: null }));
update((s) => ({ ...s, loadingCount: s.loadingCount + 1, error: null }));
try {
const repo = auth.getRepository();
@@ -144,13 +145,13 @@ function createLibraryStore() {
update((s) => ({
...s,
currentItem: item,
isLoading: false,
loadingCount: Math.max(0, s.loadingCount - 1),
}));
return item;
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to load item";
update((s) => ({ ...s, isLoading: false, error: message }));
update((s) => ({ ...s, loadingCount: Math.max(0, s.loadingCount - 1), error: message }));
throw error;
}
}
@@ -161,7 +162,7 @@ function createLibraryStore() {
return;
}
update((s) => ({ ...s, isLoading: true, error: null, searchQuery: query }));
update((s) => ({ ...s, loadingCount: s.loadingCount + 1, error: null, searchQuery: query }));
try {
const repo = auth.getRepository();
@@ -179,13 +180,13 @@ function createLibraryStore() {
update((s) => ({
...s,
searchResults: result.items,
isLoading: false,
loadingCount: Math.max(0, s.loadingCount - 1),
}));
return result;
} catch (error) {
const message = error instanceof Error ? error.message : "Search failed";
update((s) => ({ ...s, isLoading: false, error: message }));
update((s) => ({ ...s, loadingCount: Math.max(0, s.loadingCount - 1), error: message }));
throw error;
}
}
@@ -273,7 +274,7 @@ export const library = createLibraryStore();
export const libraries = derived(library, ($lib) => $lib.libraries);
export const currentLibrary = derived(library, ($lib) => $lib.currentLibrary);
export const libraryItems = derived(library, ($lib) => $lib.items);
export const isLibraryLoading = derived(library, ($lib) => $lib.isLoading);
export const isLibraryLoading = derived(library, ($lib) => $lib.loadingCount > 0);
export const libraryError = derived(library, ($lib) => $lib.error);
export const viewMode = derived(library, ($lib) => $lib.viewMode);
export const genres = derived(library, ($lib) => $lib.genres);