Fix double call on livestream page

This commit is contained in:
Rafael 2022-03-21 11:11:26 -03:00 committed by Thomas Zarebczan
parent c0015ca442
commit 52c15fc004
2 changed files with 6 additions and 6 deletions

View file

@ -11,7 +11,7 @@ import * as RENDER_MODES from 'constants/file_render_modes';
import Button from 'component/button';
import Nag from 'component/common/nag';
import * as COLLECTIONS_CONSTS from 'constants/collections';
import { LayoutRenderContext } from 'page/livestream/view';
import { LivestreamContext } from 'page/livestream/view';
import { formatLbryUrlForWeb } from 'util/url';
import FileViewerEmbeddedTitle from 'component/fileViewerEmbeddedTitle';
import useFetchLiveStatus from 'effects/use-fetch-live';
@ -71,7 +71,7 @@ export default function FileRenderInitiator(props: Props) {
doFetchChannelLiveStatus,
} = props;
const layountRendered = React.useContext(LayoutRenderContext);
const { livestreamPage, layountRendered } = React.useContext(LivestreamContext) || {};
const isMobile = useIsMobile();
@ -104,7 +104,7 @@ export default function FileRenderInitiator(props: Props) {
history.push(`/$/${PAGES.AUTH}?redirect=${encodeURIComponent(pathname)}`);
}
useFetchLiveStatus(channelClaimId, doFetchChannelLiveStatus);
useFetchLiveStatus(livestreamPage ? undefined : channelClaimId, doFetchChannelLiveStatus);
const thumbnail = useThumbnail(claimThumbnail, containerRef);

View file

@ -27,7 +27,7 @@ type Props = {
doUserSetReferrer: (string) => void,
};
export const LayoutRenderContext = React.createContext<any>();
export const LivestreamContext = React.createContext<any>();
export default function LivestreamPage(props: Props) {
const {
@ -177,7 +177,7 @@ export default function LivestreamPage(props: Props) {
}
>
{isInitialized && (
<LayoutRenderContext.Provider value={layountRendered}>
<LivestreamContext.Provider value={{ livestreamPage: true, layountRendered }}>
<LivestreamLayout
uri={uri}
hideComments={hideComments}
@ -187,7 +187,7 @@ export default function LivestreamPage(props: Props) {
showScheduledInfo={showScheduledInfo}
activeStreamUri={activeStreamUri}
/>
</LayoutRenderContext.Provider>
</LivestreamContext.Provider>
)}
</Page>
);