ui phase 10

This commit is contained in:
hamid
2026-07-19 17:13:32 +03:30
parent b638e25a0e
commit b4b8c9ea79
48 changed files with 1643 additions and 290 deletions
@@ -0,0 +1,20 @@
import { useQueryClient } from '@tanstack/react-query';
import { ticketKeys } from '../keys';
import type { TicketDetail } from '../types';
/**
* The composer's "discard and retype" affordance on a failed bubble (§3.3) — removes it from the cached
* thread so the caller can restore its text into the composer draft. Not a mutation: a message that never
* left the client has nothing to tell the server.
*/
export function useDiscardFailedMessage() {
const queryClient = useQueryClient();
return (ticketId: number, clientMessageId: string): void => {
const key = ticketKeys.detail(ticketId);
queryClient.setQueryData<TicketDetail>(key, (current) =>
current
? { ...current, messages: current.messages.filter((m) => m.clientMessageId !== clientMessageId) }
: current,
);
};
}