-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Hi!
I think that this library might not be 100% compatible with a fetchQuery.
Imagine the following setup:
- There are 2 pages,
PageAandPageBwhich have aQueryAandQueryBconnected to them respectively. - We are using
relay-query-lookup-rendereronly to read from the Relay store, data fetching is done independently viafetchQuery.
The user journey is:
- Visits
PageA.QueryAis fetched on the server, Relay store records are used to hydrate the store on the client.QueryLookupRendererreads the data from Relay store by being rendered withquery={QueryA}andrender={({props}) => <ComponentA data={props}/>} - Travels from
PageAtoPageB.
QueryBis fetched via thefetchQueryQueryLookupRendereris re-rendered withquery={QueryB}andrender={({props}) => <ComponentB data={props}/>}, data is already in the store
- Travels from
PageBtoPageA
QueryAis fetched via thefetchQuery- Possible bug - before
QueryLookupRendereris re-rendered withquery={QueryA}it actually invokes therenderfunction withpropscorresponding toQueryA, even though therenderitself is still({props}) => <ComponentB data={props}/>and thequeryprop is stillQueryB QueryLookupRendereris re-rendered withquery={QueryA}andrender={({props}) => <ComponentA data={props}/>}
I suppose that it has to do something with QueryA already being present in the Relay store. Recreating a store on every page transition fixes it.
Metadata
Metadata
Assignees
Labels
No labels