Prior `variables` are being merged into subsequent queries
See original GitHub issueIntended outcome:
In version 3.5.10
if you executed the same query on a subsequent render with different variables, it’d only use those variables. For example:
- On first render, you do
useQuery(query, { variables: { first: 10 } })
- On second render, if you do
useQuery(query, { variables: { last: 10 } })
, you’d expect the query to only execute with the variables{ last: 10 }
.
Actual outcome:
In version 3.6.0
if you execute the same query on a subsequent render with different variables, it’ll merge the previously used variables. For example:
- On first render, you do
useQuery(query, { variables: { first: 10 } })
- On second render, if you do
useQuery(query, { variables: { last: 10 } })
, the variables that actually get used in the query are{ first: 10, last: 10 }
.
How to reproduce the issue: To reproduce the issue, please reference this repo. There’s fairly simple steps to reproduce the issue in the README.
Please let me know if I should provide any additional details, from a quick preliminary investigation, I believe the issue may have been introduced in this PR, but I could be wrong.
Versions @apollo-client: 3.6.0
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Combining Queries Using Merged Dimensions
✓ Variables can be created to associate Merged. Dimensions when using multiple universes. Job (EE) is not available in the Staffing Assignments.
Read more >Tech Tip: Merging on Variables in Web Intelligence - InfoSol
Select both objects using the control key, right click and select Merge. Replace the Order Quarter in the new table with our new...
Read more >Merge queries (Power Query)
A merge query creates a new query from two existing queries. One query result contains all columns from a primary table, with one...
Read more >BusinessObjects: Merge Data from Multiple Queries
The merge function in BusinessObjects makes it possible to create a report that displays query results from multiple data sets.
Read more >Understanding how MERGE works - Knowledge Base
A MERGE with bound variables reuses existing graph elements A correct version of the enrollment query from above will MATCH on the student...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AkiraJ48 My proposed fix #9741 can be tested now by running
npm i @apollo/client@beta
to get version3.7.0-alpha.6
. Please let us know if that version seems to help (over in #9671). Thanks!Note: while that version says 3.7, PR #9741 is targeting the
main
branch, implying a 3.6.x patch release (not 3.7).3.6.5 is looking good for us, thanks for the quick fix!