question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

document behaviour when id _eq: undefined or null

See original GitHub issue

Everything worked well, but then on the client-side happened issue when selected for deletion item id has become undefined and as result, all items in the table was deleted:

{
  variables: { where: { id: { _eq: undefined } } },
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
m0ngr31commented, Aug 6, 2019

Happened to me twice recently. Wasn’t a good situation. Would be good to have this explicitly documented.

2reactions
pnappacommented, Dec 4, 2019

The reason why this happens is because:

where: { id: { _eq: null } }

reduces to

where: { id: {} }

I think this could be fixed by preventing nullable types from being compared with some operators (e.g. {_eq: X } requires X to be some type Y!). The reduction from { _eq: null } to {} is unintuitive to those unfamiliar with ternary-valued logic in SQL, especially when the column being compared is non-nullable. My 2 cents is that exposing this as a type error is a far more elegant solution to now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Determine If Variable is Undefined or NULL in JavaScript
Answer: Use the equality operator ( == ). In JavaScript if a variable has been declared, but has not been assigned a value,...
Read more >
How to check for an undefined or null variable in JavaScript?
I think the most efficient way to test for "value is null or undefined " is if ( some_variable == null ){ //...
Read more >
$eq — MongoDB Manual
Specifies equality condition. The $eq operator matches documents where the value of a field equals the specified value. ... Specifying the $eq operator...
Read more >
Need PowerShell script to check the variable, if the variable is ...
Need PowerShell script to check the variable, if the variable is undefined or Null or Empty. But I am getting the error.
Read more >
Node.js v19.3.0 Documentation
Bugs or behavior changes may surprise users when Experimental API ... If the message parameter is undefined, a default error message is assigned....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found