Try to hack auth

This commit is contained in:
Jared Palmer 2023-06-02 11:15:04 -04:00
parent d88eae7230
commit 030b23985d
19 changed files with 330 additions and 673 deletions

View file

@ -8,6 +8,7 @@ import { Plus } from "lucide-react";
import Link from "next/link";
import { unstable_cache } from "next/cache";
import { SidebarItem } from "./sidebar-item";
import { db } from "@/lib/db/schema";
export interface SidebarProps {
session?: Session;
@ -60,16 +61,7 @@ Sidebar.displayName = "Sidebar";
async function SidebarList({ session }: { session?: Session }) {
const chats = await (
await unstable_cache(
() =>
prisma.chat.findMany({
where: {
// This is for debugging, need to add scope to the query later
// userId: session?.user.id,
},
orderBy: {
updatedAt: "desc",
},
}),
() => db.query.chats.findMany({}),
// @ts-ignore
[session?.user?.id || ""],
{