From a573c72faf498cb5cbc349cfd7f90d9d73317619 Mon Sep 17 00:00:00 2001 From: Antoine Dewez <44063631+Zewed@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:52:47 -0800 Subject: [PATCH] fix(frontend): chat still refreshs on first request (#2034) # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate): --- frontend/app/chat/layout.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/frontend/app/chat/layout.tsx b/frontend/app/chat/layout.tsx index 3e073dbf6..849f11fec 100644 --- a/frontend/app/chat/layout.tsx +++ b/frontend/app/chat/layout.tsx @@ -1,6 +1,6 @@ "use client"; import { usePathname, useRouter } from "next/navigation"; -import { ReactNode, useEffect, useState } from "react"; +import { ReactNode, useEffect } from "react"; import { KnowledgeToFeedProvider } from "@/lib/context"; @@ -11,19 +11,13 @@ interface LayoutProps { const Layout = ({ children }: LayoutProps): JSX.Element => { const pathname = usePathname(); const router = useRouter(); - const [isLoading, setIsLoading] = useState(true); useEffect(() => { if (pathname === '/chat') { router.push('/search'); - } else { - setIsLoading(false); } }, [pathname, router]); - if (isLoading) { - return <> - } return (