mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-20 04:30:54 +02:00
workaround non latin character db bug
This commit is contained in:
@@ -87,9 +87,17 @@ export const useLibraryStore = create<LibraryStore>((set, get) => {
|
||||
initialize: () => {
|
||||
if (!initPromise) {
|
||||
initPromise = (async () => {
|
||||
await openLibraryDb();
|
||||
const db = await openLibraryDb();
|
||||
await get().refresh();
|
||||
set({ initialized: true });
|
||||
// One-time recovery: the v3 migration marks tracks stale (mtime = -1)
|
||||
// whose non-ASCII tags were truncated by the pre-fix op-sqlite binding.
|
||||
// Re-extract them now that binding is fixed. Fire-and-forget so startup
|
||||
// isn't blocked; rescan manages its own progress + refresh.
|
||||
const stale = await db.get<{ n: number }>('SELECT COUNT(*) AS n FROM tracks WHERE mtime = -1');
|
||||
if ((stale?.n ?? 0) > 0) {
|
||||
void get().rescan();
|
||||
}
|
||||
})().catch((err) => {
|
||||
initPromise = null; // allow retry on genuine failure
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user