Streaming Rendering
Progressive page loading for optimal user experience
This Page Uses Streaming
This documentation page demonstrates Streaming rendering with progressive content delivery
What is Streaming Rendering?
Streaming rendering in Blazor allows pages to load progressively, sending content to the browser as it becomes available. The initial page structure loads instantly, while slower data operations stream in later, providing an excellent perceived performance experience.
Instant UI
Page structure loads immediately, data streams in progressively
Better UX
Users see content loading rather than blank screens
Parallel Loading
Multiple data sources can load concurrently
How Streaming Rendering Works
Initial Response
Server sends basic page HTML with loading placeholders immediately
Parallel Processing
Server processes multiple async operations concurrently (API calls, database queries)
Progressive Updates
As each operation completes, content streams to browser and updates placeholders
Final State
All content loaded, page fully interactive with complete data
🌊 Streaming Process Visualization
Streaming Examples in This App
Recipe Detail Page
Streaming SSRRecipe details load progressively: basic info first, then ingredients, instructions, and related recipes.
Streaming Sections:
- • Recipe title and image (instant)
- • Ingredients list (database query)
- • Cooking instructions (formatted content)
- • Related recipes (recommendation API)
Dashboard Widgets
Streaming SSRHomepage dashboard loads each widget independently as data becomes available.
Progressive Widgets:
- • Recipe count (fast cache lookup)
- • Popular categories (aggregation query)
- • Recent additions (sorted database query)
- • User statistics (analytics API)
Streaming Implementation Pattern
🌊 Streaming Key Points:
- Progressive Enhancement: Start with skeleton UI, fill in content as available
- Concurrent Operations: Use Task.Run or parallel async calls for independent data
- StateHasChanged(): Trigger UI updates as each data piece arrives
- Loading States: Provide visual feedback for pending operations
Advanced Streaming Patterns
Prioritized Loading
🎯 Content Priority
Load critical content first, then enhance with secondary data.
// Priority 2: Enhanced data (100ms)
// Priority 3: Related content (500ms)
📊 Data Chunking
Break large datasets into smaller chunks for progressive loading.
// Stream additional batches
// Infinite scroll pattern
Error Handling
🛡️ Graceful Degradation
Show partial content even if some streams fail.
catch { showFallbackContent = true; }
StateHasChanged();
⏱️ Timeout Handling
Set timeouts for streaming operations to prevent infinite loading.
cts.CancelAfter(TimeSpan.FromSeconds(30));
await operation(cts.Token);
When to Use Streaming Rendering
✅ Perfect For
- • Dashboard pages - Multiple independent data sources
- • Detail pages - Core content + related/recommended items
- • Mixed data sources - Fast cache + slow API combinations
- • External dependencies - Third-party API integrations
- • Large datasets - Progressive loading of extensive content
❌ Not Ideal For
- • Simple static pages - Overhead not justified for basic content
- • Fast uniform data - All data loads quickly from single source
- • Critical dependencies - Core functionality requires all data
- • Mobile-first design - Bandwidth concerns with multiple streams
Streaming Performance Benefits
🚀 Streaming Best Practices
- Skeleton screens: Provide visual structure while content loads
- Priority ordering: Load most important content first
- Parallel processing: Run independent operations concurrently
- Graceful fallbacks: Handle failures without breaking the page
- Progress indicators: Show loading progress for longer operations
- Timeout handling: Prevent infinite loading states
- Caching strategy: Cache fast-loading components appropriately
- Performance monitoring: Track streaming metrics and user experience