Skip to content
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

fix(gatsby): Fix Loki query operators special casing #11517

Merged
merged 2 commits into from
Feb 7, 2019

Conversation

stefanprobst
Copy link
Contributor

There are subtle differences between Loki and Sift query operators that we are trying to account for. This fixes some of those:

  • Sift allows querying arrays with $eq and $ne, which translates to $contains and $containsNone in Loki
  • The special case for $nin added false, which should be undefined. This also needed removing cloning the query args with JSON.parse/stringify, because undefined=>null, but it does not seem to serve a purpose anymore anyway.
  • The fix for { $ne: true } now handles nesting levels > 2, e.g. { "foo.bar.baz": { $ne: true } }
  • The conversion to dotted query fields was producing { "": {} } for an empty object.

@stefanprobst stefanprobst requested a review from a team as a code owner February 3, 2019 13:31
@freiksenet
Copy link
Contributor

CC @Moocar

@Moocar
Copy link
Contributor

Moocar commented Feb 6, 2019

@stefanprobst thanks so much! This looks great. The only thing I'm unsure of is the removal of JSON.parse/stringify as that was there before my time. But seeing as its removal doesn't break any tests, I think you're right in removing it.

@Moocar
Copy link
Contributor

Moocar commented Feb 6, 2019

@freiksenet looks like I don't have merging rights, so I'll leave it up to you to merge (I approve).

@freiksenet freiksenet merged commit e61692d into gatsbyjs:master Feb 7, 2019
@stefanprobst stefanprobst deleted the loki-fixnetrue branch July 8, 2019 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants