Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(chat): guard the chat page prefetch behind the chat flag
  • Loading branch information
waleedlatif1 committed Aug 13, 2026
commit c43c9347a2cf69851e99dc115419f481096028a3
8 changes: 8 additions & 0 deletions apps/sim/app/workspace/[workspaceId]/chat/[chatId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Suspense } from 'react'
import { dehydrate, HydrationBoundary } from '@tanstack/react-query'
import type { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { getSession } from '@/lib/auth'
import { isChatEnabled } from '@/lib/core/config/env-flags'
import { getQueryClient } from '@/app/_shell/providers/get-query-client'
import { Home } from '@/app/workspace/[workspaceId]/home/home'
import { HomeFallback } from '@/app/workspace/[workspaceId]/home/home-fallback'
Expand All @@ -20,6 +22,12 @@ interface ChatPageProps {
}

export default async function ChatPage({ params }: ChatPageProps) {
// The layout 404s too, but pages and layouts resolve concurrently — without this
// the prefetch below still fires on its way out.
if (!isChatEnabled) {
notFound()
}

const [{ workspaceId, chatId }, session] = await Promise.all([params, getSession()])
const userId = session?.user?.id
const queryClient = getQueryClient()
Expand Down
Loading