pothos: Prisma-utils inputs can't set null values
I found prisma utils normalizes input (normalizeInputObject function) so all nulls are converted into undefined. This way prisma won’t set null values where user intended to (more: https://www.prisma.io/docs/concepts/components/prisma-client/null-and-undefined).
In example below I want to set Page.parent to null, so I call mutation { updatePage(data: { parent: null }) { ... } }, but prisma would never set parent value, because it’s undefined in the end.
builder.prismaUpdate('Page', {
fields: t => ({
parent: t.string(),
}),
})
As a workaround in yarn I patched @pothos/plugin-prisma-utils and replaced normalizeInputObject return value with object.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (14 by maintainers)
@YEriin just published a new version that should allow nulls for nullable fields for filters as well
That would be great!