Fix comment discussion mounted state when switching uris
This commit is contained in:
parent
c4a23ff856
commit
c1a67f6864
1 changed files with 11 additions and 1 deletions
|
@ -110,6 +110,16 @@ function ChannelPage(props: Props) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const showDiscussion = React.useMemo(() => {
|
||||||
|
if (discussionWasMounted && currentView !== PAGE.DISCUSSION) {
|
||||||
|
setDiscussionWasMounted(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return discussionWasMounted && currentView === PAGE.DISCUSSION;
|
||||||
|
|
||||||
|
// only re-calculate on discussionWasMounted or uri change
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [discussionWasMounted, uri]);
|
||||||
|
|
||||||
const hasUnpublishedCollections = unpublishedCollections && Object.keys(unpublishedCollections).length;
|
const hasUnpublishedCollections = unpublishedCollections && Object.keys(unpublishedCollections).length;
|
||||||
|
|
||||||
|
@ -316,7 +326,7 @@ function ChannelPage(props: Props) {
|
||||||
<ChannelAbout uri={uri} />
|
<ChannelAbout uri={uri} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
{(discussionWasMounted || currentView === PAGE.DISCUSSION) && <ChannelDiscussion uri={uri} />}
|
{(showDiscussion || currentView === PAGE.DISCUSSION) && <ChannelDiscussion uri={uri} />}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabPanels>
|
</TabPanels>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
Loading…
Reference in a new issue