You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary of all fixes & enhancements — DawaiSathi (Jul 2026)
Objective
Fix all silent failures, logging gaps, caching issues, error-handling gaps, and flaky frontend-toasts across backend and frontend before production deployment. Then enhance scanner UI with quality feedback and contextual guidance.
Important details
Backend: Flask + SQLAlchemy + SQLite; Frontend: React/TypeScript + Vite
Added global @app.errorhandler(Exception) in app.py for JSON 500s
Created safe_commit() in extensions.py — wraps commit in try/except/rollback
All 21 commit() callers use safe_commit(), relying on global error handler for JSON
n > 0 check, validates vs user.family_id; clears on logout
Empty catch in Cabinet.tsx
Cabinet.tsx
DEV log + toast on fetch failure
8 hardcoded timezones
SettingsDashboard.tsx
Dynamic via Intl.supportedValuesOf + GMT offset
IANA timezone name sent
AuthContext.tsx
syncTimezone sends tz_name
Family pills outside cabinet
AppLayout.tsx
Only renders on currentTab === 'cabinet'; dead <FamilySettings/> removed
Inbox blank name/email
FamilySettings.tsx
req.user_name → req.requester.name
Delete removes entire medicine
Cabinet.tsx
Removes only current slot; deletes entry only if last slot gone
Empty catch in FamilySettings
FamilySettings.tsx
DEV logs + toasts on fetchFamilyData and leave-family
SW not activating
sw.ts
clientsClaim() + SKIP_WAITING handler
SW night time 21:00→22:00
sw.ts
Matched backend defaults
includeTriggered removed
sw.ts
Non-standard; removed
API cache 24h→5min
sw.ts
maxAgeSeconds: 300
Image cache CacheFirst→SWR 7d
sw.ts
StaleWhileRevalidate strategy
syncTimezone infinite retry
AuthContext.tsx
maxRetries = 3 cap
Offline sync race
App.tsx
IndexedDB delete wrapped in try/catch
Logout bare catch
AuthContext.tsx
DEV log added
SW sync bare catch
Cabinet.tsx
DEV log added
Members fetch silent fail
ScanApproval.tsx
DEV log added
SW registration query fail
SettingsDashboard.tsx
DEV log added
Telegram polling silent fail
SettingsDashboard.tsx
Toast on failure
Frontend enhancements
Enhancement
File(s)
Change
Scanner error toast
Scanner.tsx
errorMsg state + UI for scan/upload failures, 4s auto-dismiss
Enhanced user prompt
Scanner.tsx
Multi-line hint with 📋 icon, "Place prescription inside frame" + "Ensure good lighting and clear text" subtext; changes to ⏳ "Analyzing with AI…" during capture
Collapsible tips badge
Scanner.tsx
💡 "Tips for better scans" toggle with 4 tips (lighting, steady, full capture, no shadows)
Camera error steps
Scanner.tsx
Step-by-step instructions (lock icon → Camera → Allow → Refresh)
Image quality analysis
Scanner.tsx
Luminance + contrast check via canvas after capture/upload; shows green "Good lighting" or red "Too dark/bright/low contrast" badge at top of camera area, auto-dismisses after 3s
Cabinet tip
Scanner.tsx
"Tip: Align prescription so medicine names and time columns are clearly visible" between error area and capture dock
Accessibility
Scanner.tsx
role="status", aria-live="polite", aria-label on hint container; aria-expanded on tips toggle