added listener for pinned permlink change

This commit is contained in:
Nouman Tahir 2022-03-25 20:05:06 +05:00
parent 5ed3bd9e2d
commit d11867f960

View File

@ -34,6 +34,7 @@ const TabContent = ({
tag,
onScrollRequestProcessed,
handleOnScroll,
pinnedPermlink,
...props
}: TabContentProps) => {
let _isMounted = true;
@ -45,7 +46,7 @@ const TabContent = ({
const isAnalytics = useSelector((state) => state.application.isAnalytics);
const nsfw = useSelector((state) => state.application.nsfw);
const isConnected = useSelector((state) => state.application.isConnected);
const username = useSelector((state) => state.account.currentAccount.name);
const {name:username, about:{profile:{pinned}}} = useSelector((state) => state.account.currentAccount);
const initPosts = useSelector((state) => state.posts.initPosts)
@ -98,6 +99,14 @@ const TabContent = ({
}
}, [filterScrollRequest])
useEffect(()=>{
if(pageType === 'ownProfile' && pinned !== pinnedPermlink )
alert("Pinned post updated: " + pinned)
throw new Error("Update pinned post");
//TODO: update pinnned post
//TOOD: remove pinned post from list if present
},[pinned])
const _cleanup = () => {
_isMounted = false;
@ -187,6 +196,7 @@ const TabContent = ({
pageType,
isLatestPostsCheck,
feedUsername:_feedUsername,
pinnedPermlink,
tag,
...props
} as LoadPostsOptions