feat: add missing disableErrors to globals findOne operation#14913
Merged
paulpopus merged 1 commit intopayloadcms:mainfrom Apr 2, 2026
Merged
Conversation
9cb8085 to
21d54f0
Compare
23a56d3 to
155c769
Compare
9ebdc43 to
c9dea01
Compare
c9dea01 to
8128105
Compare
8128105 to
ebd6d08
Compare
paulpopus
approved these changes
Apr 2, 2026
Contributor
|
🚀 This is included in version v3.82.0 |
milamer
pushed a commit
to milamer/payload
that referenced
this pull request
Apr 20, 2026
…cms#14913) ### What? This PR introduces the `disableErrors` option into the global `findOne` operation. ### Why? `disableErrors` is handy for certain flows where a user may be unauthorised but you don't need an error to be thrown, instead you would prefer an empty result. Without this, the developer needs to catch the error themselves, leading to inconsistencies as some operations have `disableErrors` and others do not. ### How? Introduced the `disableErrors` option to the global `findOne` operation. ### Additional information - Initial [discord discussion](https://discord.com/channels/967097582721572934/1102950643259424828/1438504179961430059). - A [PR](payloadcms#6357) was created to address this in mid 2024 but was later closed. - There is opportunity here to include `disableErrors` in a number of operations that seem to be lacking it, especially in the `sdk` package. Originally I included these changes in this PR but have since removed to instead allow for some discussion before we consider introducing them in a separate PR. - There is opportunity to introduce better test coverage in a separate PR for `disableErrors` across existing operations that use it. - In `packages/payload/src/collections/operations/restoreVersion.ts`, `disableErrors` exists in the types but is not actually implemented. I have left this as is for now but wanted to flag it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR introduces the
disableErrorsoption into the globalfindOneoperation.Why?
disableErrorsis handy for certain flows where a user may be unauthorised but you don't need an error to be thrown, instead you would prefer an empty result.Without this, the developer needs to catch the error themselves, leading to inconsistencies as some operations have
disableErrorsand others do not.How?
Introduced the
disableErrorsoption to the globalfindOneoperation.Additional information
disableErrorsin a number of operations that seem to be lacking it, especially in thesdkpackage. Originally I included these changes in this PR but have since removed to instead allow for some discussion before we consider introducing them in a separate PR.disableErrorsacross existing operations that use it.packages/payload/src/collections/operations/restoreVersion.ts,disableErrorsexists in the types but is not actually implemented. I have left this as is for now but wanted to flag it.