Skip to content

Feat/centralized polling and style isolation#214

Open
caxtonacollins wants to merge 6 commits into
StellarFlow-Network:mainfrom
caxtonacollins:feat/centralized-polling-and-style-isolation
Open

Feat/centralized polling and style isolation#214
caxtonacollins wants to merge 6 commits into
StellarFlow-Network:mainfrom
caxtonacollins:feat/centralized-polling-and-style-isolation

Conversation

@caxtonacollins
Copy link
Copy Markdown

Performance Improvements: Centralized Polling & Dynamic Style Isolation

Summary

This PR addresses two critical performance issues in the StellarFlow frontend:

  1. Issue 📡 Perf | Shared Poll Controls for Financial Tickers #151: Centralized polling controls for financial tickers - eliminates independent polling connections that cause browser thread locking
  2. Issue 🎨 Perf | Isolating Dynamic Style Updates #165: Isolating dynamic style updates - shifts from inline style manipulation to class-based styling for better CSS optimization

Changes

Issue #151: Shared Poll Controls

  • New: PollManager singleton service (src/app/services/pollManager.ts)

    • Manages a single shared polling loop using RAF
    • Supports multiple subscribers with independent intervals
    • Prevents multiple independent connections spawning
  • New: useCentralizedPoll hook (src/app/hooks/useCentralizedPoll.ts)

    • Provides centralized polling interface for components
    • Automatic subscription/unsubscription on mount/unmount
  • Updated: LivePrices component

    • Now uses centralized polling instead of independent WebSocket connections
    • Reduces browser thread locking and memory footprint

Issue #165: Dynamic Style Isolation

  • New: styleVariants utility (src/lib/styleVariants.ts)

    • Centralizes all dynamic style definitions
    • Provides variant functions for trend indicators, connection status, loading states
    • Replaces inline style manipulation with class-based approach
  • Updated: PriceFeedCard component

    • Uses getTrendClasses() for dynamic styling
    • Adds data attributes for CSS-based styling (data-trend-direction, data-connection-status)
    • Eliminates inline style recalculations
  • Updated: globals.css

    • New CSS classes for trend indicators, connection status, loading states
    • Data attribute selectors for CSS-based styling
    • Reduces browser rendering engine CSS optimization passes

Performance Impact

  • Thread Locking: Eliminated multiple independent polling connections
  • CSS Optimization: Reduced inline style manipulation, fewer browser reflows
  • Memory: Shared polling loop reduces memory footprint
  • Responsiveness: Better browser responsiveness due to reduced thread contention

Testing

  • Type checking: ✅ All new files pass TypeScript validation
  • No breaking changes to existing APIs
  • Backward compatible with current component usage

Closes #151
Closes #165

…nancial tickers

- Create PollManager singleton to manage shared polling loop
- Prevents multiple independent polling connections causing browser thread locking
- Uses RAF-based polling instead of setInterval for better performance
- Supports multiple subscribers with independent intervals
- Reduces memory footprint and improves responsiveness
… polling

- Hook to subscribe to centralized polling for financial tickers
- Replaces independent polling connections with shared event pipeline
- Provides data and polling status to components
- Automatically unsubscribes on unmount
… styling

- Centralize dynamic style updates using class markers and dataset tags
- Replaces inline style manipulation with standardized class variants
- Provides trend indicator, connection status, and loading state variants
- Reduces CSS optimization passes in browser rendering engine
- Improves performance by using class-based styling
…variants

- Replace inline style manipulation with styleVariants utility
- Use getTrendClasses for dynamic trend indicator styling
- Add data attributes for CSS-based styling (data-trend-direction, data-connection-status)
- Improves performance by reducing inline style recalculations
- Maintains visual consistency with centralized style definitions
…vePrices component

- Integrate centralized polling via useCentralizedPoll hook
- Replace independent WebSocket connections with shared event pipeline
- Use style variants for trend indicators
- Add data attributes for CSS-based styling
- Improves performance and reduces browser thread locking
…ates

- Add trend indicator classes (.trend-indicator--up, .trend-indicator--down)
- Add connection status classes (.connection-status--*)
- Add loading state classes (.loading-state--*)
- Add data attribute selectors for CSS-based styling
- Eliminates inline style manipulation and reduces CSS optimization passes
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

@caxtonacollins Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@caxtonacollins
Copy link
Copy Markdown
Author

@Sadeequ please check this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🎨 Perf | Isolating Dynamic Style Updates 📡 Perf | Shared Poll Controls for Financial Tickers

1 participant