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

View file

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

View file

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