Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

fix: do not assign undefined to x_filter keys #281

Merged
merged 3 commits into from
Aug 28, 2019
Merged

fix: do not assign undefined to x_filter keys #281

merged 3 commits into from
Aug 28, 2019

Conversation

tungv
Copy link
Contributor

@tungv tungv commented Jul 24, 2019

if x_filter is accidentally assigned with undefined value, the following code

    return [subSelection, { ...shallowFilterParams, ...subFilterParams }];

(https://github.com/neo4j-graphql/neo4j-graphql-js/blob/master/src/selections.js#L80)

will delete previously built filter params.

@codecov-io
Copy link

codecov-io commented Jul 24, 2019

Codecov Report

Merging #281 into master will increase coverage by 0.42%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #281      +/-   ##
==========================================
+ Coverage   95.04%   95.47%   +0.42%     
==========================================
  Files          10       10              
  Lines        2341     2341              
==========================================
+ Hits         2225     2235      +10     
+ Misses        116      106      -10
Impacted Files Coverage Δ
src/translate.js 98.64% <100%> (ø) ⬆️
src/augment.js 97.39% <0%> (+1.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f806374...7ecd48d. Read the comment docs.

@johnymontana
Copy link
Contributor

Thanks @tungv - could you please add a test with a query showing an example of what this fixes? I'd like to make sure we get it into the test suite and don't inadvertently revert the fix.

@tungv
Copy link
Contributor Author

tungv commented Jul 30, 2019

I will need some time to get familiar with the test structure. But I think it's doable.

@johnymontana
Copy link
Contributor

@tungv Great thanks! Currently, all the filtering tests are generated from this markdown file.

So you can just add a couple of tests at the end of the file using the same markdown format showing one of the GraphQL queries for the test schema that would have failed without your fix. l L

Let me know if you have any issues with it.

@tungv
Copy link
Contributor Author

tungv commented Aug 9, 2019

Hey Johny, very appreciated! The bug I found happened when you have filters for a subpath of an unfiltered path. I will look to reproduce it from the schema in test.

@johnymontana
Copy link
Contributor

Great - thanks @tungv, you can also just add an example of a failing query in this thread and I can adapt it to the test schema and add to the tests.

@tungv
Copy link
Contributor Author

tungv commented Aug 23, 2019

hi @johnymontana I added a new test on the rebased codebase to reflect the bug but I'm not sure if that is the best place to add that test.

@johnymontana
Copy link
Contributor

Thanks @tungv! So since this applies to filters on nested relationship types I can see why you weren't able to adopt it to the schema used in the existing filter tests (since that schema doesn't have any nested relationship types). I'll go ahead and merge this in, but move the test you added to a new test file, with the goal of eventually moving it to our filter tests with a more complex schema.

Thanks, again!

@johnymontana johnymontana merged commit 8d50ce0 into neo4j-graphql:master Aug 28, 2019
@tungv
Copy link
Contributor Author

tungv commented Aug 29, 2019

Thank you for merging William. How long does it usually take to an npm release?

@tungv tungv deleted the patch-1 branch August 29, 2019 00:37
@johnymontana
Copy link
Contributor

Thanks for the PR! I did a release yesterday so this is in v2.7.2 🎉

@tungv
Copy link
Contributor Author

tungv commented Aug 30, 2019

thank you @johnymontana

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants