fix: startup crash, watcher count, timeline date fallback
db.rs: - Move idx_images_taken_at creation to after ensure_column so it never runs against a schema where taken_at doesn't exist yet; this was causing a startup panic on any DB that predates Phase 1 - COALESCE(taken_at, created_at) → COALESCE(taken_at, modified_at) since created_at is never populated (modified_at is always set) - Remove dead is_tagging_job_cancelled function (superseded by is_tagging_job_processing) and unused thumbnail_path from ImagePathRecord indexer.rs: - Watcher create path now calls update_folder_count after commit_batch and emits folder-counts-changed so the sidebar count stays in sync; the notification is only emitted when the DB write actually succeeds store.ts / Timeline.tsx: - compareImages taken_asc/taken_desc: fall back to modified_at not created_at (created_at is always null) - Timeline groupImages: same fallback fix so images group by month correctly for libraries not yet re-indexed for EXIF - subscribeToProgress: listen for folder-counts-changed and call loadFolders() to keep the sidebar image count live
This commit is contained in:
+7
-2
@@ -498,9 +498,9 @@ function compareImages(a: ImageRecord, b: ImageRecord, sort: SortOrder): number
|
||||
case "duration_desc":
|
||||
return compareNullableNumber(b.duration_ms, a.duration_ms);
|
||||
case "taken_asc":
|
||||
return compareNullableDate(a.taken_at ?? a.created_at, b.taken_at ?? b.created_at);
|
||||
return compareNullableDate(a.taken_at ?? a.modified_at, b.taken_at ?? b.modified_at);
|
||||
case "taken_desc":
|
||||
return compareNullableDate(b.taken_at ?? b.created_at, a.taken_at ?? a.created_at);
|
||||
return compareNullableDate(b.taken_at ?? b.modified_at, a.taken_at ?? a.modified_at);
|
||||
default:
|
||||
return compareNullableDate(b.modified_at, a.modified_at);
|
||||
}
|
||||
@@ -1770,6 +1770,10 @@ export const useGalleryStore = create<GalleryState>((set, get) => ({
|
||||
});
|
||||
});
|
||||
|
||||
const unlistenFolderCounts = await listen("folder-counts-changed", () => {
|
||||
void get().loadFolders();
|
||||
});
|
||||
|
||||
return () => {
|
||||
unlistenProgress();
|
||||
unlistenMediaJobs();
|
||||
@@ -1778,6 +1782,7 @@ export const useGalleryStore = create<GalleryState>((set, get) => ({
|
||||
unlistenImages();
|
||||
unlistenThumbnails();
|
||||
unlistenWatcherDeleted();
|
||||
unlistenFolderCounts();
|
||||
};
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user