Don't open comment w/o new bet
This commit is contained in:
parent
65bc0f0f86
commit
bdb3bbd960
|
@ -69,9 +69,21 @@ export function FeedAnswerCommentGroup(props: {
|
|||
user,
|
||||
answer.number.toString()
|
||||
)
|
||||
const [usersMostRecentBetTimeAtLoad] = useState(
|
||||
mostRecentCommentableBet?.createdTime ?? 0
|
||||
)
|
||||
const [usersMostRecentBetTimeAtLoad, setUsersMostRecentBetTimeAtLoad] =
|
||||
useState<number | undefined>(
|
||||
!user ? undefined : mostRecentCommentableBet?.createdTime ?? 0
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (user && usersMostRecentBetTimeAtLoad === undefined)
|
||||
setUsersMostRecentBetTimeAtLoad(
|
||||
mostRecentCommentableBet?.createdTime ?? 0
|
||||
)
|
||||
}, [
|
||||
mostRecentCommentableBet?.createdTime,
|
||||
user,
|
||||
usersMostRecentBetTimeAtLoad,
|
||||
])
|
||||
|
||||
const scrollAndOpenReplyInput = useEvent(
|
||||
(comment?: Comment, answer?: Answer) => {
|
||||
|
@ -84,6 +96,7 @@ export function FeedAnswerCommentGroup(props: {
|
|||
useEffect(() => {
|
||||
if (
|
||||
mostRecentCommentableBet &&
|
||||
usersMostRecentBetTimeAtLoad !== undefined &&
|
||||
mostRecentCommentableBet.createdTime > usersMostRecentBetTimeAtLoad &&
|
||||
!showReply
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user