Prisma middleware infinite loop
Hey 👋
I have a separate table in my db that's responsible for storing logs of actions.
I want to simplify the dx by creating a Prisma middleware that will automatically create these logs.
This is my current implementation:
However, I'd like to improve this to be batching these db calls into one
prisma.$transaction()
:
However, this causes an infinite loop, because prisma.todo.create()
calls the middleawre again.
Any suggestions on how to get around this?0 Replies