Skip to content

Improve excluding fields example to not mutate data - #4794

Merged
ruheni merged 2 commits into
prisma:mainfrom
squirly:patch-1
Jun 20, 2023
Merged

Improve excluding fields example to not mutate data#4794
ruheni merged 2 commits into
prisma:mainfrom
squirly:patch-1

Conversation

@squirly

@squirly squirly commented May 22, 2023

Copy link
Copy Markdown
Contributor

Describe this PR

The current implementation of exclude in the docs mutates the passed object. The issue here is that in the example password is deleted from the passed object, user, causing a call to password to fail after exclude is called. E.G.: user.password.trim() would fail with "cannot call 'trim' on 'undefined'".

Changes

The updated version does not have this issue.

The previous implementation mutated the passed object. This updated version does not. The issue here is that in this example `password` is deleted from the passed object, `user`, causing a call to password to fail after exclude is called. E.G.: `user.password.trim()` would fail with "cannot call 'trim' on 'undefined'".
@vercel

vercel Bot commented May 22, 2023

Copy link
Copy Markdown

@squirly is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

@janpio
janpio requested a review from millsp June 20, 2023 12:35
@janpio
janpio requested review from jharrell and ruheni June 20, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants