mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #18710 from overleaf/mj-web-chat-send-thread-data
[chat+web] Inform frontend when duplicating threads GitOrigin-RevId: 285afee8f5a016a8e7ac58e9538cc3ec8362681d
This commit is contained in:
committed by
Copybot
parent
0f869f9059
commit
110b83aea0
+21
@@ -1452,6 +1452,27 @@ function useReviewPanelState(): ReviewPanel.ReviewPanelState {
|
||||
[getThread]
|
||||
)
|
||||
)
|
||||
useSocketListener(
|
||||
socket,
|
||||
'new-comment-threads',
|
||||
useCallback(
|
||||
(threads: ReviewPanelCommentThreadsApi) => {
|
||||
setCommentThreads(prevState => {
|
||||
const newThreads = { ...prevState }
|
||||
for (const threadIdString of Object.keys(threads)) {
|
||||
const threadId = threadIdString as ThreadId
|
||||
const { submitting: _, ...thread } = getThread(threadId)
|
||||
// Replace already loaded messages with the server provided ones
|
||||
thread.messages = threads[threadId].messages.map(formatComment)
|
||||
newThreads[threadId] = thread
|
||||
}
|
||||
return newThreads
|
||||
})
|
||||
handleLayoutChange({ async: true })
|
||||
},
|
||||
[getThread]
|
||||
)
|
||||
)
|
||||
|
||||
const openSubView = useRef<typeof subView>('cur_file')
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user