Skip to content

fix: Export dialog UX issues - controls remain active and no progress during initial data loading #202

@cptkoolbeenz

Description

@cptkoolbeenz

Summary

After clicking the Export button, there's a 2-3 minute delay where the export dialog shows no progress and some controls remain active, creating a confusing user experience. The actual export completes quickly (~30s) after this delay, but users may think the application is frozen.

Current Behavior

  1. User clicks Export button
  2. Export button becomes disabled
  3. Other dialog controls remain active/clickable for 2-3 minutes
  4. No progress indicator visible during this time
  5. After 2-3 minutes, progress bar appears and advances from 0-100% in ~30 seconds
  6. Total time: ~4 minutes (vast improvement from 75 minutes!)

Root Cause

The delay occurs in ExportDialogViewModel.GetLoggingSessionFromId() (lines 189-210) which loads ALL data samples from the database into memory before the optimized export even begins. This happens in the background thread but provides no progress feedback.

// This loads millions of samples into memory, taking 2-3 minutes
var loggingSession = await context.Sessions
    .AsNoTracking()
    .Where(s => s.ID == sessionId)
    .Select(s => new LoggingSession
    {
        ID = s.ID,
        DataSamples = s.DataSamples.Select(d => new DataSample { ... }).ToList()
    }).FirstOrDefaultAsync();

Proposed Solution

Option 1: Quick UX Fix (Recommended for immediate improvement)

  1. Disable ALL dialog controls immediately when Export is clicked
  2. Show indeterminate progress or "Loading data..." message during the database query phase
  3. Switch to percentage progress once actual export begins

Option 2: Full Optimization (Better long-term solution)

  1. Remove the memory-loading step entirely
  2. Pass only the session ID to OptimizedLoggingSessionExporter
  3. Let the exporter stream directly from database (it already has this capability!)
  4. This would eliminate the 2-3 minute delay completely

Implementation Details

Quick Fix Implementation:

[RelayCommand]
private void ExportLoggingSessions()
{
    IsExporting = true;
    IsDialogEnabled = false; // Disable all controls
    ExportProgressText = "Loading session data...";
    
    // Show indeterminate progress during data load
    // Then switch to percentage during actual export
}

Full Optimization Implementation:

The OptimizedLoggingSessionExporter already has database streaming capability via ExportFromDatabase(). We should:

  1. Pass session ID instead of loaded data
  2. Remove the unnecessary memory loading step
  3. Report progress from the beginning

Benefits

  • Immediate user feedback after clicking Export
  • Clear indication that export is in progress
  • No confusion about whether application is frozen
  • Prevents accidental multiple export attempts
  • With Option 2: Further reduces export time by ~50% (eliminating the 2-3 minute load)

Acceptance Criteria

  • All dialog controls disabled immediately when Export clicked
  • Progress indication visible immediately (even if indeterminate)
  • User informed of current operation ("Loading data..." then "Exporting...")
  • No period where UI appears frozen or unresponsive
  • Consider implementing Option 2 to eliminate the loading delay entirely

Testing

Test with large datasets (50M+ samples) to ensure:

  1. Controls disable immediately
  2. Progress feedback is immediate
  3. Export completes successfully
  4. Cancel button works during all phases

Related Issues

Recommendation

  1. Merge PR perf: improve data export speed for large datasets #188 as-is since the performance improvement is significant (75 min → 4 min)
  2. Create this as a follow-up ticket for the UX improvements
  3. Consider implementing Option 2 in a future PR for maximum performance

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions