Fix userInitiated undefined

This commit is contained in:
Lim Chee Aun 2022-12-23 12:30:07 +08:00
parent d3e3e47527
commit fe78ac5fa0

View file

@ -304,6 +304,9 @@ function StatusPage({ id }) {
<SubComments <SubComments
hasManyStatuses={hasManyStatuses} hasManyStatuses={hasManyStatuses}
replies={replies} replies={replies}
onStatusLinkClick={() => {
userInitiated.current = true;
}}
/> />
)} )}
{uiState === 'loading' && {uiState === 'loading' &&
@ -339,7 +342,11 @@ function StatusPage({ id }) {
); );
} }
function SubComments({ hasManyStatuses, replies }) { function SubComments({
hasManyStatuses,
replies,
onStatusLinkClick = () => {},
}) {
// If less than or 2 replies and total number of characters of content from replies is less than 500 // If less than or 2 replies and total number of characters of content from replies is less than 500
let isBrief = false; let isBrief = false;
if (replies.length <= 2) { if (replies.length <= 2) {
@ -365,9 +372,7 @@ function SubComments({ hasManyStatuses, replies }) {
<Link <Link
class="status-link" class="status-link"
href={`#/s/${replyID}`} href={`#/s/${replyID}`}
onClick={() => { onClick={onStatusLinkClick}
userInitiated.current = true;
}}
> >
<Status statusID={replyID} withinContext size="s" /> <Status statusID={replyID} withinContext size="s" />
</Link> </Link>