fix: keep today habits visible while refreshing
ci / docker (push) Successful in 5m48s

This commit is contained in:
2026-09-07 17:27:24 +08:00
parent 3772b56617
commit 5d564b0269
4 changed files with 41 additions and 8 deletions
+10
View File
@@ -114,6 +114,16 @@ export function isFabDrag(deltaX: number, deltaY: number, threshold = 8) {
return Math.hypot(deltaX, deltaY) >= threshold
}
let habitGridCache: { week: string; habits: unknown[] } | null = null
export function readHabitGridCache<T>(week: string): T[] | null {
return habitGridCache?.week === week ? habitGridCache.habits as T[] : null
}
export function writeHabitGridCache<T>(week: string, habits: T[]) {
habitGridCache = { week, habits }
}
export function formatApiErrorDetail(detail: unknown): string {
if (typeof detail === 'string') return detail
if (Array.isArray(detail)) {