Skip to content

Conversation

@olivierwilkinson
Copy link
Owner

closes #18

Prisma NullTypes are used as the null value for Json fields. When using
a NullType in a query the instance of the NullType must remain the same
or Prisma is unable to parse the value correctly, replacing it with
undefined.

Lodash cloneDeep causes these NullTypes to be new instances and so
params that use them have unexpected undefined values, causing errors.

When the Prisma client has NullTypes, which is true for v4, clone params
but pass through the instances of Prisma.JsonNull, Prisma.DbNull and
Prisma.AnyNull so that they are not replaced with undefined.

Prisma client v3 uses strings for these null types so cloneDeep works as
is in that case.

Prisma NullTypes are used as the null value for Json fields. When using
a NullType in a query the instance of the NullType must remain the same
or Prisma is unable to parse the value correctly, replacing it with
undefined.

Lodash cloneDeep causes these NullTypes to be new instances and so
params that use them have unexpected undefined values, causing errors.

When the Prisma client has NullTypes, which is true for v4, clone params
but pass through the instances of Prisma.JsonNull, Prisma.DbNull and
Prisma.AnyNull so that they are not replaced with undefined.

Prisma client v3 uses strings for these null types so cloneDeep works as
is in that case.
@olivierwilkinson olivierwilkinson merged commit fff70f4 into main Apr 19, 2023
@olivierwilkinson olivierwilkinson deleted the fix-json-null-types branch April 19, 2023 17:33
@github-actions
Copy link

🎉 This PR is included in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prisma.DbNull and Prisma.JsonNull is transformed into undefined

2 participants