question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prior `variables` are being merged into subsequent queries

See original GitHub issue

Intended 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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
benjamncommented, May 19, 2022

@AkiraJ48 My proposed fix #9741 can be tested now by running npm i @apollo/client@beta to get version 3.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).

1reaction
72636ccommented, May 24, 2022

3.6.5 is looking good for us, thanks for the quick fix!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found