import { clearChats, getChats } from '@/app/actions' import { ClearHistory } from '@/components/clear-history' import { SidebarItems } from '@/components/sidebar-items' import { ThemeToggle } from '@/components/theme-toggle' import { cache } from 'react' interface SidebarListProps { userId?: string children?: React.ReactNode } const loadChats = cache(async (userId?: string) => { return await getChats(userId) }) export async function SidebarList({ userId }: SidebarListProps) { const chats = await loadChats(userId) return (
{chats?.length ? (
) : (

No chat history

)}
0} />
) }