From d2a0ee65b3cbe497a956f41ecb5c74b7f1212fea Mon Sep 17 00:00:00 2001 From: le king fu Date: Thu, 26 Feb 2026 21:54:42 -0500 Subject: [PATCH] Fix app stuck on spinner after v0.4.0 update (GH #9) Restore seed_categories.sql to its original content so the migration 2 checksum matches existing databases. Move the level-3 insurance subcategories (310-312) into a new migration 7 using INSERT OR IGNORE. Add .catch() on connectActiveProfile() to surface DB errors. Co-Authored-By: Claude Opus 4.6 --- src-tauri/src/database/seed_categories.sql | 19 +++++-------------- src-tauri/src/lib.rs | 12 ++++++++++++ src/App.tsx | 4 +++- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/database/seed_categories.sql b/src-tauri/src/database/seed_categories.sql index 0582449..aeba40c 100644 --- a/src-tauri/src/database/seed_categories.sql +++ b/src-tauri/src/database/seed_categories.sql @@ -35,7 +35,7 @@ INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (27 INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (28, 'Transport en commun', 2, 'expense', '#3b82f6', 9); INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (29, 'Internet & Télécom', 2, 'expense', '#6366f1', 10); INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (30, 'Animaux', 2, 'expense', '#a855f7', 11); -INSERT INTO categories (id, name, parent_id, type, color, sort_order, is_inputable) VALUES (31, 'Assurances', 2, 'expense', '#14b8a6', 12, 0); +INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (31, 'Assurances', 2, 'expense', '#14b8a6', 12); INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (32, 'Pharmacie', 2, 'expense', '#f43f5e', 13); INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (33, 'Taxes municipales', 2, 'expense', '#78716c', 14); @@ -68,13 +68,6 @@ INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (71 INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (72, 'Retrait cash', 6, 'expense', '#57534e', 3); INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (73, 'Projets', 6, 'expense', '#0ea5e9', 4); --- ========================================== --- Grandchild categories (Level 3 — under Assurances) --- ========================================== -INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (310, 'Assurance-auto', 31, 'expense', '#14b8a6', 1); -INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (311, 'Assurance-habitation', 31, 'expense', '#0d9488', 2); -INSERT INTO categories (id, name, parent_id, type, color, sort_order) VALUES (312, 'Assurance-vie', 31, 'expense', '#0f766e', 3); - -- ========================================== -- Keywords -- ========================================== @@ -139,12 +132,10 @@ INSERT INTO keywords (keyword, category_id) VALUES ('ORICOM', 29); -- Animaux (30) INSERT INTO keywords (keyword, category_id) VALUES ('MONDOU', 30); --- Assurance-auto (310) -INSERT INTO keywords (keyword, category_id) VALUES ('BELAIR', 310); --- Assurance-habitation (311) -INSERT INTO keywords (keyword, category_id) VALUES ('PRYSM', 311); --- Assurance-vie (312) -INSERT INTO keywords (keyword, category_id) VALUES ('INS/ASS', 312); +-- Assurances (31) +INSERT INTO keywords (keyword, category_id) VALUES ('BELAIR', 31); +INSERT INTO keywords (keyword, category_id) VALUES ('PRYSM', 31); +INSERT INTO keywords (keyword, category_id) VALUES ('INS/ASS', 31); -- Pharmacie (32) INSERT INTO keywords (keyword, category_id) VALUES ('JEAN COUTU', 32); diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 51449af..e8ef87a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -67,6 +67,18 @@ pub fn run() { ALTER TABLE imported_files_new RENAME TO imported_files;", kind: MigrationKind::Up, }, + Migration { + version: 7, + description: "add level-3 insurance subcategories", + sql: "INSERT OR IGNORE INTO categories (id, name, parent_id, type, color, sort_order) VALUES (310, 'Assurance-auto', 31, 'expense', '#14b8a6', 1); + INSERT OR IGNORE INTO categories (id, name, parent_id, type, color, sort_order) VALUES (311, 'Assurance-habitation', 31, 'expense', '#0d9488', 2); + INSERT OR IGNORE INTO categories (id, name, parent_id, type, color, sort_order) VALUES (312, 'Assurance-vie', 31, 'expense', '#0f766e', 3); + UPDATE categories SET is_inputable = 0 WHERE id = 31; + UPDATE keywords SET category_id = 310 WHERE keyword = 'BELAIR' AND category_id = 31; + UPDATE keywords SET category_id = 311 WHERE keyword = 'PRYSM' AND category_id = 31; + UPDATE keywords SET category_id = 312 WHERE keyword = 'INS/ASS' AND category_id = 31;", + kind: MigrationKind::Up, + }, ]; tauri::Builder::default() diff --git a/src/App.tsx b/src/App.tsx index ed9a1c4..4dc7fd7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -20,7 +20,9 @@ export default function App() { useEffect(() => { if (activeProfile && !isLoading) { setDbReady(false); - connectActiveProfile().then(() => setDbReady(true)); + connectActiveProfile() + .then(() => setDbReady(true)) + .catch((err) => console.error("Failed to connect profile:", err)); } }, [activeProfile, isLoading, connectActiveProfile]);