Skip loadFolders when offline to prevent database lock
- Add debug logging to loadArtists and loadTracks - Only execute loadFolders when not offline - Prevents is_network_path blocking DB when cable disconnected
This commit is contained in:
1 parent
e13e5e70e9
commit
8b4b3e6a7f
1 file changed
+16
-3
@@ -268,7 +268,12 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await loadLibraryData();
|
await loadLibraryData();
|
||||||
loadFolders(); // Load in background - doesn't block UI
|
// Only load folders when online - offline causes DB lock via is_network_path()
|
||||||
|
if (!isOffline) {
|
||||||
|
loadFolders(); // Load in background - doesn't block UI
|
||||||
|
} else {
|
||||||
|
console.log('[LocalLibrary] Skipping loadFolders in offline mode');
|
||||||
|
}
|
||||||
checkDiscogsCredentials();
|
checkDiscogsCredentials();
|
||||||
|
|
||||||
// Subscribe to offline state changes
|
// Subscribe to offline state changes
|
||||||
@@ -460,11 +465,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadArtists() {
|
async function loadArtists() {
|
||||||
|
console.log('[LocalLibrary] loadArtists START');
|
||||||
loading = true;
|
loading = true;
|
||||||
try {
|
try {
|
||||||
|
console.log('[LocalLibrary] Calling library_get_artists');
|
||||||
artists = await invoke<LocalArtist[]>('library_get_artists', {
|
artists = await invoke<LocalArtist[]>('library_get_artists', {
|
||||||
excludeNetworkFolders: shouldExcludeNetworkFolders()
|
excludeNetworkFolders: shouldExcludeNetworkFolders()
|
||||||
});
|
});
|
||||||
|
console.log('[LocalLibrary] Received artists:', artists.length);
|
||||||
// Load cached artist images from database
|
// Load cached artist images from database
|
||||||
await loadCachedArtistImages();
|
await loadCachedArtistImages();
|
||||||
// Fetch missing images in background if enabled
|
// Fetch missing images in background if enabled
|
||||||
@@ -473,25 +481,30 @@
|
|||||||
fetchMissingArtistImages();
|
fetchMissingArtistImages();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to load artists:', err);
|
console.error('[LocalLibrary] Failed to load artists:', err);
|
||||||
error = String(err);
|
error = String(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
console.log('[LocalLibrary] loadArtists COMPLETE');
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadTracks(query = '') {
|
async function loadTracks(query = '') {
|
||||||
|
console.log('[LocalLibrary] loadTracks START, query:', query);
|
||||||
loading = true;
|
loading = true;
|
||||||
try {
|
try {
|
||||||
|
console.log('[LocalLibrary] Calling library_search');
|
||||||
tracks = await invoke<LocalTrack[]>('library_search', {
|
tracks = await invoke<LocalTrack[]>('library_search', {
|
||||||
query,
|
query,
|
||||||
limit: 1000,
|
limit: 1000,
|
||||||
excludeNetworkFolders: shouldExcludeNetworkFolders()
|
excludeNetworkFolders: shouldExcludeNetworkFolders()
|
||||||
});
|
});
|
||||||
|
console.log('[LocalLibrary] Received tracks:', tracks.length);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to load tracks:', err);
|
console.error('[LocalLibrary] Failed to load tracks:', err);
|
||||||
error = String(err);
|
error = String(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
console.log('[LocalLibrary] loadTracks COMPLETE');
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user