Skip to content

Commit

Permalink
fix(client): Don't recompute extensions list on every access (#16520)
Browse files Browse the repository at this point in the history
  • Loading branch information
SevInf committed Nov 29, 2022
1 parent fb151af commit 127167c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/client/src/runtime/core/extensions/$extends.ts
Expand Up @@ -94,7 +94,7 @@ export function $extends(this: Client, extension: Args | ((client: Client) => Cl
const oldClient = unapplyModelsAndClientExtensions(this)
const newClient = Object.create(oldClient, {
_extensions: {
get: () => this._extensions.append(extension),
value: this._extensions.append(extension),
},
})

Expand Down
Expand Up @@ -14,4 +14,10 @@ testMatrix.setupTestSuite(() => {
expectTypeOf(xprisma).not.toHaveProperty('$use')
expect(await xprisma.user.findMany()).toEqual([])
})

test('does not recompute extensions property on every access', () => {
const xprisma = prisma.$extends({})

expect((xprisma as any)._extensions).toBe((xprisma as any)._extensions)
})
})

0 comments on commit 127167c

Please sign in to comment.