My Products
Help
Christian0
CONTRIBUTOR **

Graphql filter breaking change

by Christian0

There seems to have been a breaking change in the filter logic recently, the following query with an empty filter previously returned everything as if the filter was not present, but now suddenly returns nothing:

query example($cid : Int) {
 useCompany(no: $cid) {
    product(first: 10, filter:{  }) {
      items {
        productNo
      }
    }
 }
}

 

If I strip the whole filter part away it works as expected and everything is returned:

query example($cid : Int) {
 useCompany(no: $cid) {
    product(first: 10) {
      items {
        productNo
      }
    }
 }
}

 

Is this a bug? Or will the new logic remain this way?

2 REPLIES 2
Christian0
CONTRIBUTOR **

by Christian0

Ok, then we'll update the queries on our end.

Accepted solution
Marius Bancila
CHAMPION ***

by Marius Bancila

Yes, this is correct. An empty filter and no filter are different things. If you want everything, don't specify a filter (or pass null). If you provide an empty filter you will get nothing.

 

This is related to fix for empty arguments for _in and _not_in comparison operators. See https://docs.business.visma.net/docs/releasenotes