Fix fetch

This commit is contained in:
Rafael 2022-03-15 15:38:42 -03:00 committed by Thomas Zarebczan
parent 9298bf1e51
commit 05b44fc4ab

View file

@ -16,7 +16,6 @@ import FileRenderPlaceholder from 'static/img/fileRenderPlaceholder.png';
import * as COLLECTIONS_CONSTS from 'constants/collections';
import { LayoutRenderContext } from 'page/livestream/view';
import { formatLbryUrlForWeb } from 'util/url';
import { LIVESTREAM_STATUS_CHECK_INTERVAL } from 'constants/livestream';
import FileViewerEmbeddedTitle from 'component/fileViewerEmbeddedTitle';
type Props = {
@ -112,11 +111,7 @@ export default function FileRenderInitiator(props: Props) {
// isCurrentClaimLive = already fetched
if (!channelClaimId || !isLivestreamClaim || isCurrentClaimLive) return;
const fetch = () => doFetchChannelLiveStatus(channelClaimId);
const intervalId = setInterval(fetch, LIVESTREAM_STATUS_CHECK_INTERVAL);
return () => clearInterval(intervalId);
doFetchChannelLiveStatus(channelClaimId);
}, [channelClaimId, doFetchChannelLiveStatus, isCurrentClaimLive, isLivestreamClaim]);
React.useEffect(() => {
@ -170,11 +165,11 @@ export default function FileRenderInitiator(props: Props) {
if (
(canViewFile || forceAutoplayParam) &&
((shouldAutoplay && (!videoOnPage || forceAutoplayParam) && isPlayable) ||
RENDER_MODES.AUTO_RENDER_MODES.includes(renderMode))
(!embedded && RENDER_MODES.AUTO_RENDER_MODES.includes(renderMode)))
) {
viewFile();
}
}, [canViewFile, forceAutoplayParam, isPlayable, renderMode, shouldAutoplay, viewFile]);
}, [canViewFile, embedded, forceAutoplayParam, isPlayable, renderMode, shouldAutoplay, viewFile]);
/*
once content is playing, let the appropriate <FileRender> take care of it...