Suppress StoreWriter
errors for missing fields with read
functions
#8710
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.
PR #8416 converted these missing field errors from thrown exceptions to
invariant.error
log messages, so the whole write no longer fails when one field is missing. Uninhibited by the drawbacks of throwing, PR #8416 also allowed these errors to be logged in many more (legitimate) cases than before.To reduce console noise, we should consider hiding errors that are not urgent. One case of non-urgency is when the field in question has a
read
function in its field policy, which means the field could have a default or synthetic/computed value, so it's not necessarily a mistake to omit the field from the written data. Errors for fields with(in)@client
directives are hidden as well (that's whatcontext.clientOnly
means), and this seems like a similar situation.