Commit Graph

9 Commits

Author SHA1 Message Date
3d4803f975 perf(realtime+data): implement perf-data-optimization and perf-realtime-scale
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m33s
## perf-data-optimization
- Add @@index([name]) on User model (migration)
- Add WEATHER_HISTORY_LIMIT=90 constant, apply take/orderBy on weather history queries
- Replace deep includes with explicit select on all 6 list service queries
- Add unstable_cache layer with revalidateTag on all list service functions
- Add cache-tags.ts helpers (sessionTag, sessionsListTag, userStatsTag)
- Invalidate sessionsListTag in all create/delete Server Actions

## perf-realtime-scale
- Create src/lib/broadcast.ts: generic createBroadcaster factory with shared polling
  (one interval per active session, starts on first subscriber, stops on last)
- Migrate all 6 SSE routes to use createBroadcaster — removes per-connection setInterval
- Add broadcastToXxx() calls in all Server Actions after mutations for immediate push
- Add SESSIONS_PAGE_SIZE=20, pagination on sessions page with loadMoreSessions action
- Add "Charger plus" button with loading state and "X sur Y" counter in WorkshopTabs

## Tests
- Add 19 unit tests for broadcast.ts (polling lifecycle, userId filtering,
  formatEvent, error resilience, session isolation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 15:30:54 +01:00
a8c05aa841 perf(quick-wins): batch collaborator resolution, debounce SSE refresh, loading states
- Eliminate N+1 on resolveCollaborator: add batchResolveCollaborators() in
  auth.ts (2 DB queries max regardless of session count), update all 4
  workshop services to use post-batch mapping
- Debounce router.refresh() in useLive.ts (300ms) to group simultaneous
  SSE events and avoid cascade re-renders
- Call cleanupOldEvents fire-and-forget in createEvent to purge old SSE
  events inline without blocking the response
- Add loading.tsx skeletons on /sessions and /users matching actual page
  layout (PageHeader + content structure)
- Lazy-load ShareModal via next/dynamic in BaseSessionLiveWrapper to reduce
  initial JS bundle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 08:07:22 +01:00
a10205994c refactor: improve team management, OKRs, and session components 2026-02-25 17:29:40 +01:00
Julien Froidefond
4d04d3ede8 feat: refactor session retrieval logic to utilize generic session queries, enhancing code maintainability and reducing duplication across session types 2026-02-17 14:38:54 +01:00
Julien Froidefond
aad4b7f111 feat: enhance session management by implementing edit permissions for team admins and updating session components to reflect new access controls 2026-02-17 14:20:40 +01:00
Julien Froidefond
4e14112ffa feat: add team collaboration sessions for admins, enhancing session management and visibility in the application 2026-02-17 14:03:31 +01:00
Julien Froidefond
71d850c985 chore: clean up code formatting and remove unnecessary whitespace across multiple files for improved readability 2025-12-05 11:05:14 +01:00
Julien Froidefond
eaeb1335fa feat: enhance session management by resolving collaborators to users and integrating CollaboratorDisplay component across motivators and sessions pages 2025-11-28 11:04:58 +01:00
Julien Froidefond
448cf61e66 feat: implement Moving Motivators feature with session management, real-time event handling, and UI components for enhanced user experience 2025-11-28 08:40:39 +01:00