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
Manage realtime lifecycle and optimize follower queries, plus tighten Supabase debug fallback and update docs.
- controllers/chat_controller.dart: added PetModel import; ensure realtime messages channel is unsubscribed and nulled on dispose and when active pet changes; listen to activePetProvider to load threads or reset ChatState, avoiding leaked channels and stale state.
- controllers/feed_controller.dart: replace ad-hoc fetch/subscription logic with an authProvider listener that disposes/resubscribes like/comment channels on logout/login, triggers fetchPosts on user change, and returns a clean unauthenticated FeedState to prevent duplicate realtime subscriptions.
- repositories/follow_repository.dart: use server-side count() for scalar follower/following counts; introduce fetchPetFollowerCounts to batch pet owner lookups and follower queries, deduplicate owner vs pet followers, and eliminate N+1/full-table scan patterns.
- utils/supabase_config.dart: add SUPABASE_ALLOW_EMBEDDED_DEBUG_FALLBACK dart-define (default true) and fail fast in non-release builds when fallbacks are disabled, improving security hygiene; provide clearer error messages for missing env defines.
- docs: update architecture and feature-practices docs with a May 7, 2026 implementation/status snapshot reflecting shipped fixes and remaining open items.
These changes reduce realtime duplication/leaks, improve follower-count performance, and harden local/release Supabase configuration.
Historical issue descriptions in this section pre-date several shipped fixes. Use this subsection as the ground truth for what is done vs still open relative to GitHub/issue threads.
| Story visibility / expiry (#40-class) |**Done**|`FeedState.visibleStories` + filtering. |
1126
+
| Comment avatars (#42-class) |**Done**| Join + model field wired in post detail. |
1127
+
| Appointment sync ↔ care (#25-class) |**Done**|`petCareProvider.refresh()` after upsert/cancel where applicable. |
1128
+
| Feed realtime logout/login (#41-class) |**Done**| Unsubscribelikes/comments realtime on logout; resubscribe when authenticated; clearer empty state when logged out. |
1129
+
| Follow follower `N+1` / heavy counts (#29-class) |**Done**| Repository uses `count()` where appropriate; discovery load batches counts via `fetchPetFollowerCounts` and surfaces them on swipe cards + Nearby list (`MatchState.discoveryFollowerCounts`). |
| Offline / caching epic (#55-class) |**Open**| No change to scope here. |
1133
+
| Care cache flicker (#39-class) |**Improved**| After network fetch, logs/weights lists reuse existing state when serialized payloads match baseline (cache or current UI), avoiding redundant rebuild churn when Supabase matches cache. |
0 commit comments