File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,10 +127,10 @@ export class ClientImpl {
127127 } ) ;
128128 }
129129
130- if ( baseClient ?. isTransaction && ! executor ) {
131- // if we're creating a derived client from a transaction client and not replacing
132- // the executor, reuse the current kysely instance to retain the transaction context
133- this . kysely = baseClient . $qb ;
130+ if ( baseClient ?. isTransaction ) {
131+ // preserve transaction context in derived clients: reuse the kysely instance when
132+ // no new executor is provided, or create a Transaction (not plain Kysely) when one is
133+ this . kysely = executor ? new Transaction ( this . kyselyProps ) : baseClient . $qb ;
134134 } else {
135135 this . kysely = new Kysely ( this . kyselyProps ) ;
136136 }
@@ -638,7 +638,9 @@ function createModelCrudHandler(
638638 const rootZenExecutor = ( client as unknown as ClientImpl ) . kyselyProps
639639 . executor as ZenStackQueryExecutor ;
640640 contextExecutor = rootZenExecutor
641- . withConnectionProvider ( { provideConnection : ( consumer ) => rawExecutor . provideConnection ( consumer ) } )
641+ . withConnectionProvider ( {
642+ provideConnection : ( consumer ) => rawExecutor . provideConnection ( consumer ) ,
643+ } )
642644 . withQueryContext ( queryContext ) ;
643645 }
644646
You can’t perform that action at this time.
0 commit comments