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.

useQuery requests omitted properties from previous variables (Working 3.5.10 but breaking in 3.6.1/2)

See original GitHub issue

Intended outcome:

const [variables, setVariables] = useState({deleted: true, someOther: "value"})

const { data } = useQuery(query, { variables })

// Omit the deleted property
const breakIng = () => setVariables({someOther: "value"}

If the variable omits a property that was queried before, then the old value of that variable is used in the request.

Actual outcome: The request must transfer the variables as is.

How to reproduce the issue: See above, hope it helps you.

Versions 3.5.10: works as expected 3.6.1 and 3.6.2: requests previous properties

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yura3dcommented, May 20, 2022

@benjamn Thanks, after 3.7.0-alpha.6 installing the issue is gone.

2reactions
benjamncommented, May 19, 2022

@obo-spi @yura3d My proposed fix can be tested now by running npm i @apollo/client@beta to get version 3.7.0-alpha.6. Note: while that version says 3.7, PR #9741 is targeting the main branch, implying a 3.6.x patch release (not 3.7). Please let us know if that alpha version seems to help (or not)!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The useQuery hook - with variables | Lift-off III - Apollo GraphQL
The useQuery hook returns an object with three useful properties that we use in our app: indicates whether the query has completed and...
Read more >
Nebula Graph Database Manual
Graphs are one of the main areas of research in computer science. Graphs can efficiently solve many of the problems that exist.
Read more >
useQuery | TanStack Query Docs
By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change.
Read more >
mongoose | Yarn - Package Manager
Mongoose. Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports Node.js and Deno (alpha).
Read more >
History.md - andrew.cmu.ed
isEqual false negatives bug in js-bson #2070 * fixed; missing check for ... fixed versioning tests * benchmarks; updated for pull requests 3.7.2...
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