-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document behaviour when id _eq: undefined or null #2648
Comments
The reason why this happens is because: where: { id: { _eq: null } } reduces to
which further reduces to where: {} and For now I suggest you to write the delete mutation as follows: mutation delete_article($article_id: Int!) {
delete_article(where: {id: {_eq: $article_id}}) {
affected_rows
}
} and the variables will then be: {
"article_id": 1
} Since |
Happened to me twice recently. Wasn't a good situation. Would be good to have this explicitly documented. |
I don't use: Safer: So if somehow ID becomes undefined - mutation does not affect any rows. |
@leimantas but this is just a temporary escape hatch, in any time new team member that doesn't know all hasura quirks could catch this issue. |
I think this could be fixed by preventing nullable types from being compared with some operators (e.g. |
This has been documented here: https://hasura.io/docs/1.0/graphql/manual/queries/query-filters.html#evaluation-of-null-values-in-comparision-expressions. |
@marionschleifer but the issue still here - one day some broken code could return null / undefined to graphql expression and we will be in troubles |
@pronevich we are tracking this issue here . |
Everything worked well, but then on the client-side happened issue when selected for deletion item
id
has becomeundefined
and as result, all items in the table was deleted:The text was updated successfully, but these errors were encountered: