fix: route controlled diff comment updates (#1599)

* fix: route controlled diff comment updates

* fix: address review comments overview feedback

* fix: address automated review feedback

* fix: keep failed controlled edits open

* fix: guard controlled comment deletes

* fix: compare controlled delete handler

* test: cover controlled update rerender
This commit is contained in:
José Almeida
2026-07-07 10:19:56 +01:00
committed by GitHub
parent c9063e1b0a
commit d62b51b0be
21 changed files with 1043 additions and 32 deletions
@@ -6,7 +6,12 @@ import type { SelectedLineRange } from "@pierre/diffs";
import { useCommentsStore } from "@/lib/state/slices/comments";
import { useDiffFileComments } from "@/hooks/domains/comments/use-diff-comments";
import { commentsToAnnotations, extractCodeFromDiff, extractCodeFromContent } from "@/lib/diff";
import type { DiffComment, AnnotationSide, CommentAnnotation } from "@/lib/diff/types";
import type {
DiffComment,
DiffCommentUpdate,
AnnotationSide,
CommentAnnotation,
} from "@/lib/diff/types";
interface UseDiffCommentsOptions {
sessionId: string;
@@ -29,7 +34,7 @@ interface UseDiffCommentsReturn {
/** Remove a comment */
removeComment: (commentId: string) => void;
/** Update a comment */
updateComment: (commentId: string, updates: Partial<DiffComment>) => void;
updateComment: (commentId: string, updates: DiffCommentUpdate) => void;
/** Currently editing comment ID */
editingCommentId: string | null;
/** Set the editing comment ID */
@@ -104,7 +109,7 @@ export function useDiffComments({
);
const updateComment = useCallback(
(commentId: string, updates: Partial<DiffComment>) => {
(commentId: string, updates: DiffCommentUpdate) => {
storeUpdateComment(commentId, updates);
},
[storeUpdateComment],