fix reposts page when navigating directly by url
This commit is contained in:
parent
1875c37ed3
commit
6e953c098c
3 changed files with 21 additions and 7 deletions
|
@ -136,7 +136,7 @@ function ClaimListDiscover(props: Props) {
|
||||||
claim_type?: Array<string>,
|
claim_type?: Array<string>,
|
||||||
name?: string,
|
name?: string,
|
||||||
duration?: string,
|
duration?: string,
|
||||||
reposted_claim_id: string,
|
reposted_claim_id?: string,
|
||||||
stream_types?: any,
|
stream_types?: any,
|
||||||
} = {
|
} = {
|
||||||
page_size: pageSize || CS.PAGE_SIZE,
|
page_size: pageSize || CS.PAGE_SIZE,
|
||||||
|
@ -598,9 +598,13 @@ function ClaimListDiscover(props: Props) {
|
||||||
hideBlock={hideBlock}
|
hideBlock={hideBlock}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="card">
|
{loading && (
|
||||||
{loading && new Array(CS.PAGE_SIZE).fill(1).map((x, i) => <ClaimPreview key={i} placeholder="loading" />)}
|
<div className="card">
|
||||||
</div>
|
{new Array(CS.PAGE_SIZE).fill(1).map((x, i) => (
|
||||||
|
<ClaimPreview key={i} placeholder="loading" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, selectFollowedTags } from 'lbry-redux';
|
import { makeSelectClaimForUri, selectFollowedTags, doResolveUri } from 'lbry-redux';
|
||||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||||
import * as CS from 'constants/claim_search';
|
import * as CS from 'constants/claim_search';
|
||||||
import Tags from './view';
|
import Tags from './view';
|
||||||
|
@ -17,4 +17,5 @@ const select = (state, props) => {
|
||||||
|
|
||||||
export default connect(select, {
|
export default connect(select, {
|
||||||
doToggleTagFollowDesktop,
|
doToggleTagFollowDesktop,
|
||||||
|
doResolveUri,
|
||||||
})(Tags);
|
})(Tags);
|
||||||
|
|
|
@ -16,15 +16,17 @@ type Props = {
|
||||||
repostedUri: string,
|
repostedUri: string,
|
||||||
repostedClaim: ?GenericClaim,
|
repostedClaim: ?GenericClaim,
|
||||||
doToggleTagFollowDesktop: string => void,
|
doToggleTagFollowDesktop: string => void,
|
||||||
|
doResolveUri: string => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
function TagsPage(props: Props) {
|
function DiscoverPage(props: Props) {
|
||||||
const {
|
const {
|
||||||
location: { search },
|
location: { search },
|
||||||
followedTags,
|
followedTags,
|
||||||
repostedClaim,
|
repostedClaim,
|
||||||
repostedUri,
|
repostedUri,
|
||||||
doToggleTagFollowDesktop,
|
doToggleTagFollowDesktop,
|
||||||
|
doResolveUri,
|
||||||
} = props;
|
} = props;
|
||||||
const buttonRef = useRef();
|
const buttonRef = useRef();
|
||||||
const isHovering = useHover(buttonRef);
|
const isHovering = useHover(buttonRef);
|
||||||
|
@ -33,6 +35,7 @@ function TagsPage(props: Props) {
|
||||||
const claimType = urlParams.get('claim_type');
|
const claimType = urlParams.get('claim_type');
|
||||||
const tagsQuery = urlParams.get('t') || null;
|
const tagsQuery = urlParams.get('t') || null;
|
||||||
const tags = tagsQuery ? tagsQuery.split(',') : null;
|
const tags = tagsQuery ? tagsQuery.split(',') : null;
|
||||||
|
const repostedClaimIsResolved = repostedUri && repostedClaim;
|
||||||
|
|
||||||
// Eventually allow more than one tag on this page
|
// Eventually allow more than one tag on this page
|
||||||
// Restricting to one to make follow/unfollow simpler
|
// Restricting to one to make follow/unfollow simpler
|
||||||
|
@ -44,6 +47,12 @@ function TagsPage(props: Props) {
|
||||||
label = __('Unfollow');
|
label = __('Unfollow');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (repostedUri && !repostedClaimIsResolved) {
|
||||||
|
doResolveUri(repostedUri);
|
||||||
|
}
|
||||||
|
}, [repostedUri, repostedClaimIsResolved, doResolveUri]);
|
||||||
|
|
||||||
function handleFollowClick() {
|
function handleFollowClick() {
|
||||||
if (tag) {
|
if (tag) {
|
||||||
doToggleTagFollowDesktop(tag);
|
doToggleTagFollowDesktop(tag);
|
||||||
|
@ -98,4 +107,4 @@ function TagsPage(props: Props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TagsPage;
|
export default DiscoverPage;
|
||||||
|
|
Loading…
Add table
Reference in a new issue