Skip to content

UX/UI: No Loading States for API Calls #11

@PU-MEriksson

Description

@PU-MEriksson

Problem
Currently, when users click "Generate plan", there's no visual feedback while the OpenAI API processes their request. This creates a poor user experience because:

Users don't know if their request is being processed
On slow connections or when the API is under load, users might think the app is broken
Users may click the button multiple times, potentially creating duplicate requests
There's no indication of progress during what can be a 3-10 second wait time

Current Behavior

  • User clicks "Generate plan" button
  • Button becomes disabled but shows no loading indication
  • User stares at a static screen with no feedback
  • Plan suddenly appears when API call completes

Expected Behavior

  • User clicks "Generate plan" button
  • Clear loading indicator appears (spinner, skeleton, or progress message)
  • User understands the app is working and processing their request
  • Smooth transition when plan is ready

Proposed Solution
Add comprehensive loading states for all API interactions in the plan generation flow.

Acceptance Criteria

  • Loading spinner or skeleton appears when "Generate plan" is clicked
  • Loading state persists until API response is received
  • Button shows loading state (spinner + "Generating..." text)
  • Loading state is accessible (screen reader announcements)
  • Error states are handled gracefully if API calls fail
  • Loading states work for both plan generation and plan editing
  • No duplicate requests can be made while loading

Implementation Details

Technical Approach:
Add loading state to form submission
Create reusable loading component/spinner
Add loading text variations ("Generating your plan...", "Processing...", etc.)
Implement proper error boundaries for failed API calls
Add ARIA labels for accessibility

Design Suggestions

  • Use a subtle spinner with descriptive text
  • Consider a skeleton loader for the result area
  • Show encouraging messages like "Creating your personalized action plan..."
  • Ensure loading state matches the app's visual design

User Impact
High: This significantly improves user experience and perceived performance
Accessibility: Better experience for all users, especially those with slower connections
Confidence: Users will trust the app is working correctly

Additional Context
This issue affects the core user flow and should be prioritized as it directly impacts user satisfaction and app usability. The loading time can vary significantly based on:

  • OpenAI API response time
  • User's internet connection
  • Complexity of the task being processed

Related Issues
Consider adding retry functionality for failed API calls
Future: Add request timeout handling
Future: Add offline state detection

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions