Fix missing subs in sidebar on login

At least show the original list
This commit is contained in:
infinite-persistence 2022-03-07 10:41:54 +08:00
parent 5ba7b5e705
commit 65931202b0
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
3 changed files with 11 additions and 3 deletions

View file

@ -121,7 +121,7 @@ type Props = {
activeChannelStakedLevel: number,
wildWestDisabled: boolean,
doClearClaimSearch: () => void,
doFetchLastActiveSubs: (count?: number) => void,
doFetchLastActiveSubs: (force?: boolean, count?: number) => void,
};
function SideNavigation(props: Props) {
@ -313,7 +313,8 @@ function SideNavigation(props: Props) {
const filter = subscriptionFilter.toLowerCase();
displayedSubscriptions = subscriptions.filter((sub) => sub.channelName.toLowerCase().includes(filter));
} else {
displayedSubscriptions = lastActiveSubs || subscriptions.slice(0, SIDEBAR_SUBS_DISPLAYED);
displayedSubscriptions =
lastActiveSubs && lastActiveSubs.length > 0 ? lastActiveSubs : subscriptions.slice(0, SIDEBAR_SUBS_DISPLAYED);
}
return (

View file

@ -1,5 +1,6 @@
import { connect } from 'react-redux';
import { doResolveUris } from 'redux/actions/claims';
import { doFetchLastActiveSubs } from 'redux/actions/subscriptions';
import { selectLastActiveSubscriptions, selectSubscriptionUris } from 'redux/selectors/subscriptions';
import ChannelsFollowingManage from './view';
@ -10,6 +11,7 @@ const select = (state) => ({
const perform = {
doResolveUris,
doFetchLastActiveSubs,
};
export default connect(select, perform)(ChannelsFollowingManage);

View file

@ -29,10 +29,11 @@ type Props = {
subscribedChannelUris: Array<string>,
lastActiveSubs: ?Array<Subscription>,
doResolveUris: (uris: Array<string>, returnCachedClaims: boolean, resolveReposts: boolean) => void,
doFetchLastActiveSubs: (force?: boolean, count?: number) => void,
};
export default function ChannelsFollowingManage(props: Props) {
const { subscribedChannelUris, lastActiveSubs, doResolveUris } = props;
const { subscribedChannelUris, lastActiveSubs, doResolveUris, doFetchLastActiveSubs } = props;
// The locked-on-mount full set of subscribed uris.
const [uris, setUris] = React.useState([]);
@ -82,6 +83,10 @@ export default function ChannelsFollowingManage(props: Props) {
// eslint-disable-next-line react-hooks/exhaustive-deps, (only need to respond to 'filterQuery')
}, [filterQuery]);
React.useEffect(() => {
doFetchLastActiveSubs(true);
}, []);
return (
<Page className="followManage-wrapper" noFooter>
<div className="card__title-section">