-
Notifications
You must be signed in to change notification settings - Fork 787
BUG/FEATURE? Cache always returns "error" and "data" even when variables change #1963
Comments
@juanmagalhaes I believe I've encountered the same issue. I made a minimal repo to demonstrate it. I think it has to do with the fact that the Here's my demo repo: https://github.com/tobobo/apollo-sandbox/tree/9fa96f2fcc2447badbbbc417ab5f7a56ef540772 You can try it by running
If you visit http://localhost:4200, you'll see a Interestingly, if you visit http://localhost:4200#2 to show the error first, you can successfully click "show data 1" and load the data with |
Utilizing a
|
I might be wrong but aren't you always forcing the component to rerender with this approach @BrettStatman ? It might be bad for performance. I ran your sample here @tobobo and that is indeed the same problem I had back then. Sorry about the delay I'm caught up in several projects lately... |
This was an error and was fixed in #2718 (and released in |
The application that I am currently working on has a page that lists some data from the server in a table.
In order to achieve this, first the user fills some form fields that will be the variables to filter the query and then press the
search
button.The query looks something like this:
The component tha calls the Query looks like this:
I don't know if what is happening is a bug or an intentional feature.
How to reproduce the issue:
Data is cached by apollo and
Query
component calls child render prop with the desired result ondata
prop.plate
on purpose so that the server will return handled errors for that field. The query returnserror
prop, apollo caches it and theQuery
component will call children render prop witherror
prop from server and the lastdata
cached (Is that suposed to happen?)...if (error)
because theQuery
component renders witherror
anddata
both from the cache.Intended outcome:
I believe that every time the query result is returned from cache it should only return
data
orerror
the same way it did when it was first called for that variables.Actual outcome:
After both results
error
anddata
are cached, each subsequent call to these queries with the same variables will returnerror
anddata
Version:
The text was updated successfully, but these errors were encountered: