fix(notifications): treat /c/new as no current conversation

useMatch('/c/:conversationId') treats the literal URL /c/new as a
real conversation id, so the toast suppression check confused
'user is on /c/new' with 'user is on the conversation needing
approval'. Explicit guard: when the matched id is 'new', fall
through to the no-match case so approval toasts still surface.
This commit is contained in:
Alex
2026-05-12 19:11:32 +01:00
parent 150d9f4e37
commit e70a7a5115

View File

@@ -32,12 +32,20 @@ export default function ToolApprovalToast() {
// place a conversation in view: the bare ``/c/:conversationId`` and
// the agent-scoped ``/agents/:agentId/c/:conversationId``. Hooks
// are unconditional; the toast just respects whichever matches.
//
// ``/c/new`` is the conversation route's literal-string placeholder
// for "unknown / not-yet-loaded conversation" (see the rewrite in
// the conversation route). Treat it the same as no match — the
// user isn't viewing any specific conversation yet, so an approval
// toast for any conversation should still surface.
const plainMatch = useMatch('/c/:conversationId');
const agentMatch = useMatch('/agents/:agentId/c/:conversationId');
const currentConversationId =
const matchedConversationId =
plainMatch?.params.conversationId ??
agentMatch?.params.conversationId ??
null;
const currentConversationId =
matchedConversationId === 'new' ? null : matchedConversationId;
// Conversation name lookup — best-effort. The slice's
// ``preference.conversations.data`` is populated by