I just found out why my typescript autocomplete wa...
# orm-help
t
I just found out why my typescript autocomplete was so slow all the time. When you setup prisma like following https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#prevent-hot-reloading-from-cre[…]-new-instances-of-prismaclient Typescript gets barely useable. I replaced it with basic
export const prisma = new PrismaClient();
and all performance issues were resolved. Should I create a ticket for that?
r
This is to prevent multiple
PrismaClient
being instantiated when using hot-reloading in development. Try this one. This doesn’t seem slow at all for me:
Copy code
import { PrismaClient } from '@prisma/client'

declare global {
  var prisma: PrismaClient | undefined
}

export const prisma =
  global.prisma ||
  new PrismaClient({
    log: ['query'],
  })

if (process.env.NODE_ENV !== 'production') global.prisma = prisma