Game Night Planner
I've reviewed the app thoroughly and found several issues that could cause it to fail silently or show blank/broken states:
**Problems Found & Fixed:**
1. **No error handling anywhere** — Every single `async` function (`loadUsers`, `loadGames`, `loadGameNights`, `loadNotifications`, `loadFoodForActiveEvent`, etc.) had zero try/catch blocks. If *any* Deplixo API call failed (network issue, auth problem, API change), the entire app would silently crash and show permanent loading spinners.
2. **No graceful fallback if Deplixo SDK isn't loaded** — If the Deplixo SDK script wasn't included or failed to load, the app would crash immediately with "deplixo is not defined". Added a demo/fallback mode that shows the UI structure with placeholder data.
3. **Boot function had no error boundary** — The entire `boot()` function was unwrapped. A single failure anywhere (auth, db init, seeding games) would leave the app in a broken loading state. Now wrapped in try/catch with a visible error message.
4. **Notification API response format assumption** — `loadNotifications` assumed `res.items` exists, but the API might return an array directly. Added format detection.
5. **RSVP and host flows had no error handling** — Submitting RSVPs, hosting games, sending notifications, saving avatars — all could fail silently. Added try/catch with user-facing error toasts.
6. **Calendar never rendered on error** — If boot failed, the calendar stayed empty. Now it renders regardless.
**Suggestions for further improvement:**
- Add the Deplixo SDK `<script>` tag if it's missing from the page
- Add a local storage fallback for single-user/offline demo mode
- Add input validation (date can't be in the past, display name length limits)
- Add a loading overlay that's dismissed once boot completes
- Consider debouncing the `onChange` handlers to avoid rapid re-renders
The app should now display properly even if backend calls fail, showing empty states instead of stuck spinners.
Altro di melinda