Sasha commited on
Commit
78d6a51
·
1 Parent(s): 955c641

fix: prevent full-screen spinner on background stream polls

Browse files
Files changed (1) hide show
  1. client/src/App.jsx +8 -4
client/src/App.jsx CHANGED
@@ -421,12 +421,16 @@ export default function App() {
421
  };
422
  }, []);
423
 
424
- // Fetch stats when selected stream changes
 
 
 
 
 
 
 
425
  useEffect(() => {
426
  if (selectedStreamId && serverStatus === 'online') {
427
- fetchAllStats();
428
-
429
- // Setup polling if the selected stream is live (end_time is null)
430
  const selectedStream = streams.find(s => s.id === parseInt(selectedStreamId));
431
  const isLive = selectedStream && !selectedStream.end_time;
432
 
 
421
  };
422
  }, []);
423
 
424
+ // Fetch stats when selected stream changes (with loading spinner)
425
+ useEffect(() => {
426
+ if (selectedStreamId && serverStatus === 'online') {
427
+ fetchAllStats(true);
428
+ }
429
+ }, [selectedStreamId, serverStatus]);
430
+
431
+ // Manage polling intervals when selected stream changes or streams update
432
  useEffect(() => {
433
  if (selectedStreamId && serverStatus === 'online') {
 
 
 
434
  const selectedStream = streams.find(s => s.id === parseInt(selectedStreamId));
435
  const isLive = selectedStream && !selectedStream.end_time;
436