previousData is lost when useLazyQuery's executor is called
See original GitHub issueIntended outcome:
Extraneous calls of the callback returned by useLazyQuery
should have no effect.
Actual outcome:
Calling the callback always sets the previousData
to undefined
. To avoid this behaviour, the user has to keep track of “has the callback been called already?”
How to reproduce the issue: Here is a codesandbox which should demonstrate the issue in the console tab. There’s a variable you can tweak to enable/disable the workaround.
Versions
System:
OS: macOS 10.15.7
Binaries:
snip
Browsers:
Chrome: 87.0.4280.67
Firefox: 80.0.1
Safari: 14.0
npmPackages:
@apollo/client: ^3.3.1 => 3.3.1
apollo: ^2.31.1 => 2.31.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Queries - Apollo GraphQL Docs
First, we'll create a GraphQL query named GET_DOGS . ... The useLazyQuery hook is perfect for executing queries in response to events besides...
Read more >What Happens When An Estate Executor Loses Capacity?
If an executor is losing capacity or incapacitated, it is wise to ask him or her to consider resigning from the role voluntarily...
Read more >Guidelines for Individual Executors & Trustees
After an individual's death, his or her assets will be gathered, business affairs settled, debts paid, necessary tax returns filed, and assets distributed...
Read more >Executor of Estate: What Do They Do? - Forbes
If you refuse, an alternate or contingent executor named in the will (or administrator appointed by the probate court judge) will handle the ......
Read more >Fiduciary of an Estate | NY CourtHelp - Unified Court System
After a person dies, their property (also called the estate) must be ... to the person who died or the named Executor if...
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
My initial thought is “no”, but could you give an example of what the
useEffect
callback would look like? I agree that the distinction betweenexecute
andrefetch
has always felt like a wart, but I get the impression thatuseLazyQuery
is very widely used, so its removal might be upsetting to people if the replacement is much less ergonomic. Thanks for looking into this!This should now be resolved in
@apollo/client@3.5.0
. Let us know if you notice any issues. Thanks!