const pendingRenames = new Map(); export const cancelPendingRename = (topicId: string, attemptId?: string | null) => { const pending = pendingRenames.get(topicId); if (pending && pending.attemptId === attemptId) { pending.controller.abort(); pendingRenames.delete(topicId); } }; export const completeRename = (topicId: string, attemptId: string) => { if (pendingRenames.get(topicId)?.attemptId === attemptId) { pendingRenames.delete(topicId); } }; export const addPendingRename = (topicId: string, attemptId: string) => { const controller = new AbortController(); pendingRenames.set(topicId, { attemptId, controller }); return controller; };