[V1] Nix-Based Release Script & History Optimizations

This commit is contained in:
Youwes09
2026-02-22 22:07:21 -06:00
parent 11247a69fe
commit 55d1431673
14 changed files with 478 additions and 103 deletions
+8
View File
@@ -164,6 +164,14 @@ export const useStore = create<Store>()(
history: [],
addHistory: (entry) =>
set((s) => {
const existing = s.history.findIndex((h) => h.chapterId === entry.chapterId);
if (existing === 0) {
// Same chapter is already at the top — just update pageNumber and readAt in place
const updated = [...s.history];
updated[0] = { ...updated[0], pageNumber: entry.pageNumber, readAt: entry.readAt };
return { history: updated };
}
// New chapter or chapter not at top — remove old entry, prepend fresh
const deduped = s.history.filter((h) => h.chapterId !== entry.chapterId);
return { history: [entry, ...deduped].slice(0, 300) };
}),