Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
fix(frontend): give /new routes dedicated tab titles and add sticky fallback
Sergey Kozyrenko0db486837a80
diff --git a/frontend/src/components/shared/page-title.tsx b/frontend/src/components/shared/page-title.tsxindex e6bcf761..d5bac485 100644--- a/frontend/src/components/shared/page-title.tsx+++ b/frontend/src/components/shared/page-title.tsx@@ -1,3 +1,5 @@+import { useState } from 'react';+const APP_NAME = 'PentAGI';interface PageTitleProps {@@ -5,6 +7,13 @@ interface PageTitleProps {* Page-specific prefix. Skipped when nullish/empty so loading states can* render `<PageTitle>{flow?.title}</PageTitle>` without temporarily* setting the tab title to "— PentAGI".+ *+ * While this component is mounted (i.e. the user stays on the same route),+ * the last non-empty value is "sticky" — a brief loading state (e.g. when+ * DetailNavigation switches between siblings and the next document is in+ * flight) keeps showing the previous title rather than flashing the+ * generic "Provider/Knowledge/Template — PentAGI" fallback. State is+ * tied to the component instance so it resets cleanly on route change.*/children?: null | string;}@@ -16,5 +25,15 @@ interface PageTitleProps {* instead of the static "PentAGI" coming from index.html.*/export function PageTitle({ children }: PageTitleProps) {- return <title>{children ? `${children} — ${APP_NAME}` : APP_NAME}</title>;+ const [sticky, setSticky] = useState<null | string>(children ?? null);++ // React 19 supports setState during render for derived state; it triggers+ // a synchronous re-render before commit and avoids a one-frame flicker.+ if (children && children !== sticky) {+ setSticky(children);+ }++ const effective = children || sticky;++ return <title>{effective ? `${effective} — ${APP_NAME}` : APP_NAME}</title>;}diff --git a/frontend/src/pages/knowledges/knowledge.tsx b/frontend/src/pages/knowledges/knowledge.tsxindex 32cbabe6..d391d426 100644--- a/frontend/src/pages/knowledges/knowledge.tsx+++ b/frontend/src/pages/knowledges/knowledge.tsx@@ -69,7 +69,7 @@ function Knowledge() {if (!isNew && isLoadingKnowledge) {return (<>- <PageTitle>{knowledge?.question ?? 'Knowledge'}</PageTitle>+ <PageTitle>{isNew ? 'New knowledge' : (knowledge?.question ?? 'Knowledge')}</PageTitle><KnowledgeLayoutisNew={false}knowledge={knowledge}@@ -85,7 +85,7 @@ function Knowledge() {if (!isNew && !knowledge) {return (<>- <PageTitle>{knowledge?.question ?? 'Knowledge'}</PageTitle>+ <PageTitle>{isNew ? 'New knowledge' : (knowledge?.question ?? 'Knowledge')}</PageTitle><KnowledgeLayoutisNew={false}knowledge={knowledge}@@ -108,7 +108,7 @@ function Knowledge() {return (<>- <PageTitle>{knowledge?.question ?? 'Knowledge'}</PageTitle>+ <PageTitle>{isNew ? 'New knowledge' : (knowledge?.question ?? 'Knowledge')}</PageTitle><KnowledgeForminitialValues={initialValues}isNew={isNew}diff --git a/frontend/src/pages/settings/settings-provider.tsx b/frontend/src/pages/settings/settings-provider.tsxindex a4c8ad72..3e6e2468 100644--- a/frontend/src/pages/settings/settings-provider.tsx+++ b/frontend/src/pages/settings/settings-provider.tsx@@ -1364,7 +1364,7 @@ function SettingsProvider() {if (loading) {return (<>- <PageTitle>{providerName ?? 'Provider'}</PageTitle>+ <PageTitle>{isNew ? 'New provider' : (providerName || 'Provider')}</PageTitle><StatusCarddescription="Please wait while we fetch provider configuration"icon={<Loader2 className="text-muted-foreground size-16 animate-spin" />}@@ -1377,7 +1377,7 @@ function SettingsProvider() {if (error) {return (<>- <PageTitle>{providerName ?? 'Provider'}</PageTitle>+ <PageTitle>{isNew ? 'New provider' : (providerName || 'Provider')}</PageTitle><Alert variant="destructive"><AlertCircle className="size-4" /><AlertTitle>Error loading provider data</AlertTitle>@@ -1395,7 +1395,7 @@ function SettingsProvider() {return (<>- <PageTitle>{providerName ?? 'Provider'}</PageTitle>+ <PageTitle>{isNew ? 'New provider' : (providerName || 'Provider')}</PageTitle><div className="flex flex-col gap-4"><div className="flex flex-col gap-2"><h2 className="flex items-center gap-2 text-lg font-semibold">diff --git a/frontend/src/pages/templates/template.tsx b/frontend/src/pages/templates/template.tsxindex cbe34df1..6f45f0ec 100644--- a/frontend/src/pages/templates/template.tsx+++ b/frontend/src/pages/templates/template.tsx@@ -660,7 +660,7 @@ function Template() {if (!isNew && isLoadingTemplate) {return (<>- <PageTitle>{templateName ?? 'Template'}</PageTitle>+ <PageTitle>{isNew ? 'New template' : (templateName ?? 'Template')}</PageTitle>{pageHeader}<div className="flex min-h-[calc(100dvh-3rem)] items-center justify-center"><Spinner variant="circle" />@@ -673,7 +673,7 @@ function Template() {if (!isNew && !isLoadingTemplate && !templateData?.flowTemplate) {return (<>- <PageTitle>{templateName ?? 'Template'}</PageTitle>+ <PageTitle>{isNew ? 'New template' : (templateName ?? 'Template')}</PageTitle>{pageHeader}<div className="flex min-h-[calc(100dvh-3rem)] items-center justify-center p-4"><Card className="w-full max-w-2xl">@@ -690,7 +690,7 @@ function Template() {return (<>- <PageTitle>{templateName ?? 'Template'}</PageTitle>+ <PageTitle>{isNew ? 'New template' : (templateName ?? 'Template')}</PageTitle>{pageHeader}<div className="flex min-h-[calc(100dvh-3rem)]"><div className="flex min-w-0 flex-1 items-center justify-center p-4">