mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-21 16:51:57 +00:00
dedup fix streamscreen
This commit is contained in:
parent
c358c794ec
commit
7a64851256
1 changed files with 85 additions and 67 deletions
|
|
@ -498,10 +498,11 @@ export const StreamsScreen = () => {
|
|||
const { colors } = currentTheme;
|
||||
const { pauseTrailer, resumeTrailer } = useTrailer();
|
||||
|
||||
// Add ref to prevent excessive updates
|
||||
// Add refs to prevent excessive updates and duplicate loads
|
||||
const isMounted = useRef(true);
|
||||
const loadStartTimeRef = useRef(0);
|
||||
const hasDoneInitialLoadRef = useRef(false);
|
||||
const isLoadingStreamsRef = useRef(false);
|
||||
|
||||
// CustomAlert state
|
||||
const [alertVisible, setAlertVisible] = useState(false);
|
||||
|
|
@ -729,9 +730,23 @@ export const StreamsScreen = () => {
|
|||
|
||||
// Update useEffect to check for sources
|
||||
useEffect(() => {
|
||||
// Reset initial load state when content changes
|
||||
hasDoneInitialLoadRef.current = false;
|
||||
isLoadingStreamsRef.current = false;
|
||||
|
||||
const checkProviders = async () => {
|
||||
if (__DEV__) console.log('[StreamsScreen] checkProviders() start', { id, type, episodeId, fromPlayer });
|
||||
logger.log(`[StreamsScreen] checkProviders() start id=${id} type=${type} episodeId=${episodeId || 'none'} fromPlayer=${!!fromPlayer}`);
|
||||
|
||||
// Prevent duplicate calls if already loading
|
||||
if (isLoadingStreamsRef.current) {
|
||||
if (__DEV__) console.log('[StreamsScreen] checkProviders() skipping - already loading');
|
||||
return;
|
||||
}
|
||||
|
||||
isLoadingStreamsRef.current = true;
|
||||
|
||||
try {
|
||||
// Check for Stremio addons
|
||||
const hasStremioProviders = await stremioService.hasStreamProviders();
|
||||
if (__DEV__) console.log('[StreamsScreen] hasStremioProviders:', hasStremioProviders);
|
||||
|
|
@ -803,6 +818,9 @@ export const StreamsScreen = () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
isLoadingStreamsRef.current = false;
|
||||
}
|
||||
};
|
||||
|
||||
checkProviders();
|
||||
|
|
|
|||
Loading…
Reference in a new issue