mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 11:53:40 -05:00
Wrap onCommentEdited in useCallback (#17379)
GitOrigin-RevId: 3171ed2a50502d0771457a3f3547eacec33efa20
This commit is contained in:
parent
55da43a6ce
commit
b608c5eae6
1 changed files with 11 additions and 12 deletions
|
@ -956,11 +956,8 @@ function useReviewPanelState(): ReviewPanelStateReactIde {
|
|||
[onThreadDeleted, projectId]
|
||||
)
|
||||
|
||||
const onCommentEdited: ReviewPanel.UpdaterFn<'saveEdit'> = (
|
||||
threadId: ThreadId,
|
||||
commentId: CommentId,
|
||||
content: string
|
||||
) => {
|
||||
const onCommentEdited = useCallback(
|
||||
(threadId: ThreadId, commentId: CommentId, content: string) => {
|
||||
setCommentThreads(prevState => {
|
||||
const thread = { ...getThread(threadId) }
|
||||
thread.messages = thread.messages.map(message => {
|
||||
|
@ -968,7 +965,9 @@ function useReviewPanelState(): ReviewPanelStateReactIde {
|
|||
})
|
||||
return { ...prevState, [threadId]: thread }
|
||||
})
|
||||
}
|
||||
},
|
||||
[getThread]
|
||||
)
|
||||
|
||||
const saveEdit = useCallback(
|
||||
(threadId: ThreadId, commentId: CommentId, content: string) => {
|
||||
|
|
Loading…
Reference in a new issue