This commit is contained in:
@@ -28,14 +28,14 @@ export function useTaskOperations({ taskId, showToast, setUrlState, setShowCreat
|
|||||||
|
|
||||||
const handleComment = useCallback(async (body: string, attachments?: Array<{ name: string; contentBase64: string }>) => {
|
const handleComment = useCallback(async (body: string, attachments?: Array<{ name: string; contentBase64: string }>) => {
|
||||||
if (!taskId) return;
|
if (!taskId) return;
|
||||||
try {
|
// Let send failures propagate to ChatPane, which preserves the draft +
|
||||||
await postLocalTaskComment(taskId, body, 'user', attachments);
|
// attachments and shows an inline error with a retry button. Swallowing the
|
||||||
qc.invalidateQueries({ queryKey: ['localTaskDetail', taskId] });
|
// error here would make ChatPane treat the send as successful and clear the
|
||||||
qc.invalidateQueries({ queryKey: ['localTasks'] });
|
// user's input (losing the prompt and attachments on failure).
|
||||||
} catch {
|
await postLocalTaskComment(taskId, body, 'user', attachments);
|
||||||
showToast(t('toast.commentFailed'), 'error');
|
qc.invalidateQueries({ queryKey: ['localTaskDetail', taskId] });
|
||||||
}
|
qc.invalidateQueries({ queryKey: ['localTasks'] });
|
||||||
}, [taskId, qc, showToast, t]);
|
}, [taskId, qc]);
|
||||||
|
|
||||||
const handleDelete = useCallback(async () => {
|
const handleDelete = useCallback(async () => {
|
||||||
if (!taskId) return;
|
if (!taskId) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user