summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhaoyuren <13851610112@163.com>2026-03-15 19:16:42 -0500
committerhaoyuren <13851610112@163.com>2026-03-15 19:16:42 -0500
commit533bcdd91ff143df46e92351b2fee90b1f221aaf (patch)
tree56e609d53daac57d58179595d1bc6f09fef85cdc /src
parentc667ff6a58b36b67bb92ff5a20df646e0777c6d5 (diff)
Fix resolved comment highlights not disappearing immediately
The resolve-thread socket event was only handled in ReviewPanel's useEffect, but ReviewPanel is conditionally mounted (only when visible). When Claude Code resolves a comment via MCP with the panel hidden, the resolvedThreadIds store was never updated, so the editor highlight persisted until the user opened the Review panel. Fix: add a comments:event listener in App.tsx (always mounted) that updates resolvedThreadIds for resolve/reopen/delete-thread events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src')
-rw-r--r--src/renderer/src/App.tsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index cb14123..1905e79 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -122,6 +122,30 @@ export default function App() {
useAppStore.getState().setCommentContexts(data.contexts)
})
+ // Listen for comment events to update resolvedThreadIds immediately
+ // (ReviewPanel may not be mounted, so highlights wouldn't update otherwise)
+ const unsubCommentsEvent = window.api.onCommentsEvent?.((event) => {
+ const { type, args } = event
+ const store = useAppStore.getState()
+ if (type === 'resolve-thread') {
+ const threadId = args[0] as string
+ store.setResolvedThreadIds(new Set([...(store.resolvedThreadIds || []), threadId]))
+ } else if (type === 'reopen-thread') {
+ const threadId = args[0] as string
+ const ids = new Set(store.resolvedThreadIds || [])
+ ids.delete(threadId)
+ store.setResolvedThreadIds(ids)
+ } else if (type === 'delete-thread') {
+ const threadId = args[0] as string
+ const newCtx = { ...store.commentContexts }
+ delete newCtx[threadId]
+ store.setCommentContexts(newCtx)
+ const ids = new Set(store.resolvedThreadIds || [])
+ ids.delete(threadId)
+ store.setResolvedThreadIds(ids)
+ }
+ })
+
// Listen for remote cursor updates
const unsubCursorUpdate = window.api.onCursorRemoteUpdate((raw) => {
const data = raw as {
@@ -181,6 +205,7 @@ export default function App() {
unsubNewDoc()
unsubInitThreads?.()
unsubInitContexts?.()
+ unsubCommentsEvent?.()
unsubCursorUpdate()
unsubCursorDisconnected()
remoteCursors.clear()