mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-05-21 21:05:05 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user