docs icon indicating copy to clipboard operation
docs copied to clipboard

Docs Transaction: Clear documentation on when a query (promise) can be created and used in a Txn

Open rj-au opened this issue 1 year ago • 1 comments

It is unclear of when a promise (query or mutation) can be created that we want included in a trasaction. When a promise is created, it is most comment for the I/O call to be made immediately. I'm hoping this is not the case for Prisma queries/mutation (just like GQL dataloaders).

There was an old issue discussing clarification back in V3, and the result was the Prisma doco being updated: https://github.com/prisma/prisma/discussions/13564#discussioncomment-9015929

Since then, and a few versions of the doco later, this info is missing.

So it would be nice to update the doco if this is still the case.

NOTE: in order for the promise to only fire when await/then, and not immediately, there would have to be a process.nextTick() (or a zero setTimeout)` - does that sound right?

rj-au avatar Apr 05 '24 01:04 rj-au

This might be relevant here: https://www.prisma.io/docs/orm/reference/prisma-client-reference#prismapromise-behavior

janpio avatar Apr 05 '24 08:04 janpio