Conversation
Resolves the issue where session/goal items showed "Error loading goal" during slow network conditions by eliminating the N+1 query pattern. - Use useEnrichedCoachingSessionsForUser with include=goal for batch loading - Add relationshipId parameter to filter sessions on the backend - Replace plain text loading states with Skeleton and Spinner components - Improve UX with proper loading indicators instead of error-like messages
- Move EntityApiError class from general.ts to entity-api-error.ts - Add static type guard: EntityApiError.isEntityApiError() - Add isServiceUnavailable() method for 503 status detection - Handle 503 errors in session selector with user-friendly message - Re-export from general.ts for backward compatibility
jhodapp
commented
Feb 5, 2026
Member
Author
There was a problem hiding this comment.
FYI: Just moved this existing class from general.ts to its own type file entity-api-error.ts - this should have been done a while ago.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix the session selector dropdown showing "Error loading goal" messages when goals are actually just loading slowly due to network latency or database connection resource exhaustion on the backend. This was caused by an N+1 query pattern where each session item made its own API call.
GitHub Issue: Fixes #255
Changes
useEnrichedCoachingSessionsForUserbatch requestrelationshipIdparameter tolistForUseranduseEnrichedCoachingSessionsForUserfor backend filteringSkeletoncomponents in dropdownSpinnerloading indicators for display valueEntityApiErrorclass to dedicated file (src/types/entity-api-error.ts)EntityApiError.isEntityApiError()static type guard methodisServiceUnavailable()method for future useScreenshots / Videos Showing UI Changes (if applicable)
Testing Strategy
/users/{userId}/coaching_sessions(not N+1)Concerns
None - this is a straightforward optimization that maintains existing functionality while improving UX and performance.