Problem
A list write executed through the transaction context passed to context.transaction(async (tx) => ...) runs its afterTransaction hook as soon as that individual write pipeline returns. The outer transaction callback can still perform later writes or throw, so an external side effect launched by that hook can escape even though the surrounding interactive transaction ultimately rolls back.
The transaction-scoped Prisma client has no $transaction method, so applications can currently detect this shape and defer dispatch manually until context.transaction() resolves, but that is an undocumented and fragile workaround.
Requested API/behavior
Please either:
- defer nested list
afterTransaction hooks until the owning context.transaction() settles, supplying its committed/rolled-back outcome; or
- expose an explicit supported signal that the list write is nested in an outer interactive transaction so applications can safely coordinate after-commit effects.
Context
Found while fixing application issue borisno2/emily-calder-performing-arts#2992. Direct writes can use the existing committed afterTransaction pattern, while trial conversion and rollover currently require explicit post-transaction() dispatch to guarantee rollback safety.
Problem
A list write executed through the transaction context passed to
context.transaction(async (tx) => ...)runs itsafterTransactionhook as soon as that individual write pipeline returns. The outer transaction callback can still perform later writes or throw, so an external side effect launched by that hook can escape even though the surrounding interactive transaction ultimately rolls back.The transaction-scoped Prisma client has no
$transactionmethod, so applications can currently detect this shape and defer dispatch manually untilcontext.transaction()resolves, but that is an undocumented and fragile workaround.Requested API/behavior
Please either:
afterTransactionhooks until the owningcontext.transaction()settles, supplying its committed/rolled-back outcome; orContext
Found while fixing application issue borisno2/emily-calder-performing-arts#2992. Direct writes can use the existing committed
afterTransactionpattern, while trial conversion and rollover currently require explicit post-transaction()dispatch to guarantee rollback safety.