Skip to content

Commit 7dce822

Browse files
fix: ensure runtime env var reading for configurable headline
- Convert chat pages to async server components so process.env reads happen at runtime instead of build time - Add force-dynamic to all routes reading env vars - Use nullish coalescing (??) instead of logical OR (||) for headline fallback to allow intentionally empty strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Optimus (AI Agent) <agent@fulcria.com>
1 parent 1413a18 commit 7dce822

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

ui/src/app/agents/[namespace]/[name]/chat/[chatId]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
"use client";
2-
import { use } from "react";
31
import ChatInterface from "@/components/chat/ChatInterface";
42

5-
export default function ChatPageView({ params }: { params: Promise<{ name: string; namespace: string; chatId: string }> }) {
6-
const { name, namespace, chatId } = use(params);
3+
export const dynamic = "force-dynamic";
4+
5+
export default async function ChatPageView({ params }: { params: Promise<{ name: string; namespace: string; chatId: string }> }) {
6+
const { name, namespace, chatId } = await params;
77

88
return <ChatInterface
99
selectedAgentName={name}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import ChatInterface from "@/components/chat/ChatInterface";
2-
import { use } from 'react';
2+
3+
export const dynamic = "force-dynamic";
34

45
// This page component receives props (like params) from the Layout
5-
export default function ChatAgentPage({ params }: { params: Promise<{ name: string, namespace: string }> }) {
6-
const { name, namespace } = use(params);
6+
export default async function ChatAgentPage({ params }: { params: Promise<{ name: string, namespace: string }> }) {
7+
const { name, namespace } = await params;
78
const headline = process.env.NEXT_PUBLIC_HEADLINE;
89
return <ChatInterface selectedAgentName={name} selectedNamespace={namespace} headline={headline} />;
910
}

ui/src/components/chat/ChatInterface.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se
627627
) : storedMessages.length === 0 && streamingMessages.length === 0 && !isStreaming ? (
628628
<div className="flex items-center justify-center h-full min-h-[50vh]">
629629
<div className="bg-card p-6 rounded-lg shadow-sm border max-w-md text-center">
630-
<h3 className="text-lg font-medium mb-2">{headline || "Start a conversation"}</h3>
630+
<h3 className="text-lg font-medium mb-2">{headline ?? "Start a conversation"}</h3>
631631
<p className="text-muted-foreground">
632632
To begin chatting with the agent, type your message in the input box below.
633633
</p>

0 commit comments

Comments
 (0)