You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our app we make heavy use of the readField function to for client fields on our schema. When we're using these fields we often send in a reference or object as the second argument to the function. What we find though is that in some more complicated functions that it's possible for the reference or object to be undefined. This is often due to the relationship / reference we pass in having no data when we request it from the our graph.
Unfortunately, this introduces the possibility for a bug because we're now reading a field from the original object rather than the reference. In some cases where the the original object has the same field you won’t even know you’re running into an issue or that you're working off the wrong data.
It's difficult to catch this is happening until you really dig in to the readField function and add lots of logging.
In reading the code for the readField function I noticed that the function checks for undefined. I think a more robust solution could check for the presence of the from argument rather than the presence of a value. That way we could throw an error or a warning that the reference or object is undefined.
How to reproduce the issue:
Working on a reproduction now and I'll update.
The text was updated successfully, but these errors were encountered:
Hi 👋
In our app we make heavy use of the
readField
function to for client fields on our schema. When we're using these fields we often send in a reference or object as the second argument to the function. What we find though is that in some more complicated functions that it's possible for the reference or object to be undefined. This is often due to the relationship / reference we pass in having no data when we request it from the our graph.Unfortunately, this introduces the possibility for a bug because we're now reading a field from the original object rather than the reference. In some cases where the the original object has the same field you won’t even know you’re running into an issue or that you're working off the wrong data.
It's difficult to catch this is happening until you really dig in to the
readField
function and add lots of logging.In reading the code for the
readField
function I noticed that the function checks for undefined. I think a more robust solution could check for the presence of thefrom
argument rather than the presence of a value. That way we could throw an error or a warning that the reference or object is undefined.How to reproduce the issue:
Working on a reproduction now and I'll update.
The text was updated successfully, but these errors were encountered: