@@ -144,8 +144,8 @@ export const CommentsListItem = memo(function CommentsListItem(props: CommentsLi
144
144
} = props
145
145
const { t} = useTranslation ( commentsLocaleNamespace )
146
146
const [ value , setValue ] = useState < CommentMessage > ( EMPTY_ARRAY )
147
- const [ collapsed , setCollapsed ] = useState < boolean > ( true )
148
- const didExpand = useRef < boolean > ( false )
147
+ const [ collapsed , setCollapsed ] = useState ( true )
148
+ const [ didExpand , setDidExpand ] = useState ( false )
149
149
const replyInputRef = useRef < CommentInputHandle > ( null )
150
150
151
151
const { isTopLayer} = useLayer ( )
@@ -238,7 +238,7 @@ export const CommentsListItem = memo(function CommentsListItem(props: CommentsLi
238
238
const handleExpand = useCallback ( ( e : MouseEvent < HTMLButtonElement > ) => {
239
239
e . stopPropagation ( )
240
240
setCollapsed ( false )
241
- didExpand . current = true
241
+ setDidExpand ( true )
242
242
} , [ ] )
243
243
244
244
const splicedReplies = useMemo ( ( ) => {
@@ -258,10 +258,10 @@ export const CommentsListItem = memo(function CommentsListItem(props: CommentsLi
258
258
} , [ replies ?. length ] )
259
259
260
260
useEffect ( ( ) => {
261
- if ( replies . length > MAX_COLLAPSED_REPLIES && ! didExpand . current ) {
261
+ if ( replies . length > MAX_COLLAPSED_REPLIES && ! didExpand ) {
262
262
setCollapsed ( true )
263
263
}
264
- } , [ replies ] )
264
+ } , [ replies , didExpand ] )
265
265
266
266
const renderedReplies = useMemo (
267
267
( ) =>
@@ -356,7 +356,7 @@ export const CommentsListItem = memo(function CommentsListItem(props: CommentsLi
356
356
/>
357
357
</ Stack >
358
358
359
- { showCollapseButton && ! didExpand . current && (
359
+ { showCollapseButton && ! didExpand && (
360
360
< Flex gap = { 1 } paddingY = { 1 } sizing = "border" >
361
361
< SpacerAvatar />
362
362
0 commit comments