Merge branch 'nt/no-user-crash' into nt/pin-from-feed

This commit is contained in:
noumantahir 2022-04-13 05:21:11 +05:00
commit 9d5c752802

View File

@ -47,9 +47,12 @@ const TabContent = ({
const isAnalytics = useSelector((state) => state.application.isAnalytics);
const nsfw = useSelector((state) => state.application.nsfw);
const isConnected = useSelector((state) => state.application.isConnected);
const {name:username, about:{profile:{pinned}}} = useSelector((state) => state.account.currentAccount);
const currentAccount = useSelector((state) => state.account.currentAccount);
const initPosts = useSelector((state) => state.posts.initPosts)
const username = currentAccount.username;
const curPinned = currentAccount.about?.pinned;
//state
const [posts, setPosts] = useState([]);
@ -72,6 +75,8 @@ const TabContent = ({
sessionUserRef.current = sessionUser;
//side effects
useEffect(() => {
@ -101,13 +106,11 @@ const TabContent = ({
}, [filterScrollRequest])
useEffect(()=>{
if(pageType === 'ownProfile' && pinned !== pinnedPermlink ){
// setPinnedPermlink(pinnedPermlink)
// alert("This is called")
if(pageType === 'ownProfile' && curPinned !== pinnedPermlink ){
_scrollToTop();
_loadPosts({shouldReset:true, _pinnedPermlink:pinned})
_loadPosts({shouldReset:true, _pinnedPermlink:curPinned})
}
},[pinned])
},[curPinned])
const _cleanup = () => {