Skip to content

Commit e262cfd

Browse files
committed
fix(plugin-detail): a refused delete in the comment panel no longer leaves an unhandled rejection
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUH1jEKbDzYRc4nghq
1 parent ddef257 commit e262cfd

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎ui/packages/app-shell/src/views/RecordDetailView.feedCommentEditDelete-12268.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ describe('each control is handed over under its own grant on sys_comment (object
525525
});
526526
expect(dataSource.delete).not.toHaveBeenCalled();
527527
expect(
528-
(doorFetch.mock.calls as Array<[unknown, { method?: string }?]>).filter(([, init]) => init?.method === 'DELETE').map(([url]) => String(url)),
528+
(doorFetch.mock.calls as unknown as Array<[unknown, { method?: string }?]>).filter(([, init]) => init?.method === 'DELETE').map(([url]) => String(url)),
529529
).toEqual([expect.stringMatching(/\/api\/v1\/comments\/c-ada$/)]);
530530
});
531531

‎ui/packages/plugin-detail/src/comments/CommentThread.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ export const CommentThread: React.FC<RecordCommentThreadProps> = ({
185185
ownDeletesOnly,
186186
(item.replyCount ?? 0) > 0 || replies.some((reply) => reply.parentId != null && String(reply.parentId) === String(item.id)),
187187
)
188-
? () => void onDeleteComment(item.id)
188+
? () => {
189+
// A refused delete kept the row, and the host has said so.
190+
void Promise.resolve(onDeleteComment(item.id)).catch(() => undefined);
191+
}
189192
: undefined,
190193
});
191194

0 commit comments

Comments
 (0)