Add some useEffect dependencies (#289)

This commit is contained in:
Marshall Polaris 2022-05-21 14:48:15 -07:00 committed by GitHub
parent cd602755be
commit 3db1de6b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ export function FeedAnswerCommentGroup(props: {
if (router.asPath.endsWith(`#${answerElementId}`)) {
setHighlighted(true)
}
}, [router.asPath])
}, [answerElementId, router.asPath])
return (
<Col className={'flex-1 gap-2'}>

View File

@ -132,7 +132,7 @@ export function FeedComment(props: {
if (router.asPath.endsWith(`#${comment.id}`)) {
setHighlighted(true)
}
}, [router.asPath])
}, [comment.id, router.asPath])
// Only calculated if they don't have a matching bet
const { userPosition, outcome } = getBettorsLargestPositionBeforeTime(
@ -287,7 +287,7 @@ export function CommentInput(props: {
useEffect(() => {
if (!replyToUsername || !user || replyToUsername === user.username) return
const replacement = `@${replyToUsername} `
setComment(replacement + comment.replace(replacement, ''))
setComment((comment) => replacement + comment.replace(replacement, ''))
}, [user, replyToUsername])
async function submitComment(betId: string | undefined) {