Skip to content

Commit 0a46d48

Browse files
committed
refactor: local refactor
1 parent abeac6f commit 0a46d48

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

packages/orm/src/client/client-impl.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,14 @@ export class ClientImpl {
128128
});
129129
}
130130

131-
this.kysely = new Kysely(this.kyselyProps);
132-
if (!executor && baseClient?.isTransaction) {
131+
if (baseClient?.isTransaction && !executor) {
132+
// if we're creating a derived client from a transaction client and not replacing
133+
// the executor, reuse the current kysely instance to retain the transaction context
133134
this.kysely = baseClient.$qb;
135+
} else {
136+
this.kysely = new Kysely(this.kyselyProps);
134137
}
138+
135139
this.inputValidator =
136140
baseClient?.inputValidator ??
137141
new InputValidator(this as any, { enabled: this.$options.validateInput !== false });
@@ -959,12 +963,7 @@ function collectExtResultFieldDefs(
959963
* - Injects `needs` fields into `select` when ext result fields are explicitly selected
960964
* - Recurses into `include` and `select` for nested relation fields
961965
*/
962-
function prepareArgsForExtResult(
963-
args: unknown,
964-
model: string,
965-
schema: SchemaDef,
966-
plugins: AnyPlugin[],
967-
): unknown {
966+
function prepareArgsForExtResult(args: unknown, model: string, schema: SchemaDef, plugins: AnyPlugin[]): unknown {
968967
if (!args || typeof args !== 'object') {
969968
return args;
970969
}

0 commit comments

Comments
 (0)