Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(GraphQL): multiple queries in a single request should not share t…
…he same variables (#5953) Fixes GraphQL-570. Earlier, sending a query like this: ``` query ($filter: CountryFilter!){ qc0: queryCountry(filter: $filter) { id name } qc1: queryCountry(filter: $filter) { id name } } ``` where $filter is a GraphQL variable as below: ``` { "filter": { "id": [ "0x0" ] } } ``` would fetch you results like this: ``` "data": { "qc0": [ { "id": "0x2711", "name": "India" }, { "id": "0x2712", "name": "Australia" }, { "id": "0x2713", "name": "US" } ], "qc1": [] } ``` While you should have got empty results for both the queries as `0x0` is not a uid that exists. This PR fixes the above bug by doing a deep-copy of field arguments if variables are provided, so avoiding sharing the same memory address across all the queries in a request. Hence, avoiding any bugs that could be caused as a result of modification of that shared memory address.
- Loading branch information