From 2179c8fdce44aca87ec19707da9db371f7ce9c47 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 3 Dec 2025 12:00:09 -0600 Subject: [PATCH] Revert "Don't display toast on own chat page" This reverts commit 00b476085d68a9dfdacaa79e2a601eee7b591144. --- src/components/SessionMonitor.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/SessionMonitor.tsx b/src/components/SessionMonitor.tsx index 2d663ec7..f3db0bf9 100644 --- a/src/components/SessionMonitor.tsx +++ b/src/components/SessionMonitor.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef } from 'react'; import { useSessionManager } from '@/hooks/useSessionManager'; import { useToast } from '@/hooks/useToast'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; /** * Global component that monitors AI sessions and shows notifications @@ -11,6 +11,7 @@ export function SessionMonitor() { const sessionManager = useSessionManager(); const { toast } = useToast(); const navigate = useNavigate(); + const location = useLocation(); const previousLoadingStates = useRef>(new Map()); useEffect(() => { @@ -24,20 +25,18 @@ export function SessionMonitor() { if (!session) return; // Check if user is currently viewing this project or chat - // Use window.location.pathname to get the current path at the time the event fires - const pathParts = window.location.pathname.split('/'); - const currentId = pathParts[2] ? decodeURIComponent(pathParts[2]) : ''; // /project/{projectId} or /chat/{chatId} + const pathParts = location.pathname.split('/'); + const currentId = pathParts[2]; // /project/{projectId} or /chat/{chatId} const isCurrentView = session.projectId === currentId; // Only show notification if user is not currently viewing this project or chat if (!isCurrentView) { - const viewPath = session.isChat ? `/chat/${session.projectId}` : `/project/${session.projectId}`; toast({ title: "AI Session Complete", description: `Finished working on ${session.projectId}`, action: (