You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
Intended outcome:
I have a list of items that displays data from Query component and a modal form that opens up and calls refetch from the aforementioned Query component when the form is submitted. After network request from refetch has been completed, the component should re-render itself to pass the updated loading/networkStatus values to the render prop, even if the data returned from the server is the same as the data in local cache.
#2840)
* Update lastResult whenever data changes to ensure components re-render if result is set back to original lastResult
* Add a regression test to verify this is fixed
Base on the reproduction provided in #2887.
* Changelog update
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Intended outcome:
I have a list of items that displays data from
Query
component and a modal form that opens up and callsrefetch
from the aforementionedQuery
component when the form is submitted. After network request fromrefetch
has been completed, the component should re-render itself to pass the updatedloading
/networkStatus
values to the render prop, even if the data returned from the server is the same as the data in local cache.Actual outcome:
After network request from calling
refetch
has been completed, thequeryObservable
'snext
handler gets called, but second if block (https://github.com/apollographql/react-apollo/blob/master/src/Query.tsx#L335-L342)prevents the component from re-rendering.
How to reproduce the issue:
https://stackblitz.com/edit/react-bv7rtg?file=index.js
Please follow the link to see how to reproduce a simplified version of my current situation. It seems that when I toggle
open
state inApp
component (equivalent to opening a modal form), thelastResult
variable inQuery
component (defined here https://github.com/apollographql/react-apollo/blob/master/src/Query.tsx#L126) is set to the last query result which looks something likeand when the
refetch
request is done, the query result that gets passed to thequeryObservable
'snext
handler (https://github.com/apollographql/react-apollo/blob/master/src/Query.tsx#L327-L346) isThis satisfies the second if block (https://github.com/apollographql/react-apollo/blob/master/src/Query.tsx#L335-L342) so
updateCurrentData
doesn't get called and theQuery
component is not re-rendered.Version
The text was updated successfully, but these errors were encountered: