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
Intended outcome:
Upon initial reactDOM.hydrate() of SSR'd components, I do not expect useQuery() to run twice.
Currently it runs once returning
{ loading: true, data: { some: 'data' } }
and then a second time returning
{ loading: false, data: { some 'data' } }
I would expect an Apollo Client cache which has data via cache.restore() already to only run once during SSR hydration, returning
{ loading: false, data: { some 'data' } }
Actual outcome:
During initial "React hydration" of SSR'd components, I am seeing both loading: true and data present from useQuery(), and then the query is immediately re-ran again, and loading: false and data is the next state:
The text was updated successfully, but these errors were encountered:
bwhitty
changed the title
@apollo/[email protected]: useQuery returns loading and data, then runs a second time
@apollo/[email protected]: SSR: useQuery returns loading and data, then runs a second time
Feb 14, 2020
Intended outcome:
Upon initial
reactDOM.hydrate()
of SSR'd components, I do not expectuseQuery()
to run twice.Currently it runs once returning
and then a second time returning
I would expect an Apollo Client cache which has data via
cache.restore()
already to only run once during SSR hydration, returningActual outcome:
During initial "React hydration" of SSR'd components, I am seeing both
loading: true
anddata
present fromuseQuery()
, and then the query is immediately re-ran again, andloading: false
anddata
is the next state:How to reproduce the issue:
Also posted on Spectrum chat https://spectrum.chat/apollo/apollo-client/loading-true-and-data-during-initial-ssr-re-hydration-3-0-beta~0fca008b-1954-4003-9132-66a0e84ac3f3
Versions
The text was updated successfully, but these errors were encountered: