Skip to content

Commit

Permalink
PopoutChat: fix empty page on 'members-only livestreams'
Browse files Browse the repository at this point in the history
## Ticket
2909

The popout is a separate instance (same as separate tabs), and the popout components aren't within any of the resolve HOCs, so the membership data had to be re-fetched.
  • Loading branch information
infinite-persistence committed Oct 12, 2023
1 parent 03e45ba commit 6bb6cd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/page/popoutChatWrapper/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { doMembershipList } from 'redux/actions/memberships';
import { buildURI } from 'util/lbryURI';
import { connect } from 'react-redux';
import { doCommentSocketConnectAsCommenter, doCommentSocketDisconnectAsCommenter } from 'redux/actions/websocket';
Expand Down Expand Up @@ -32,6 +33,7 @@ const perform = {
doCommentSocketConnectAsCommenter,
doCommentSocketDisconnectAsCommenter,
doResolveUri,
doMembershipList,
};

export default connect(select, perform)(PopoutChatPage);
11 changes: 11 additions & 0 deletions ui/page/popoutChatWrapper/view.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
import { getChannelIdFromClaim, getChannelNameFromClaim } from 'util/claim';
import { formatLbryChannelName } from 'util/url';
import { lazyImport } from 'util/lazyImport';
import Page from 'component/page';
Expand All @@ -13,6 +14,7 @@ type Props = {
doCommentSocketConnectAsCommenter: (string, string, string, ?boolean) => void,
doCommentSocketDisconnectAsCommenter: (string, string) => void,
doResolveUri: (string, boolean) => void,
doMembershipList: ({ channel_name: string, channel_id: string }) => Promise<CreatorMemberships>,
isProtectedContent: boolean,
contentUnlocked: boolean,
contentRestrictedFromUser: boolean,
Expand All @@ -25,6 +27,7 @@ export default function PopoutChatPage(props: Props) {
doCommentSocketConnectAsCommenter,
doCommentSocketDisconnectAsCommenter,
doResolveUri,
doMembershipList,
isProtectedContent,
contentUnlocked,
contentRestrictedFromUser,
Expand Down Expand Up @@ -59,6 +62,14 @@ export default function PopoutChatPage(props: Props) {
uri,
]);

React.useEffect(() => {
if (claim) {
const channelName = getChannelNameFromClaim(claim) || 'invalid';
const channelId = getChannelIdFromClaim(claim) || 'invalid';
doMembershipList({ channel_name: channelName, channel_id: channelId });
}
}, [claim, doMembershipList]);

if (contentRestrictedFromUser) {
return (
<div className="main--empty">
Expand Down

0 comments on commit 6bb6cd4

Please sign in to comment.