-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
My app has main Redux store which Apollo attached to, with store rehydration and server side rendering.
When the page is first loaded (Server side rendering), apollo/queries/0 has the following initial value (which seems valid):
The query is as follow ($page = 1):
apollo.query({
variables: translatedQueries,
query: gql`
query Search($page:Int) {
search(page: $page)
{
products {
id
name
}
}
}
` })
.then(response => {console.log(response.data.search); response.data.search}
Problem
When the same query is run again on client but with different $page variable (i.e. move to 2nd page), apollo.query returns prematurely after APOLLO_QUERY_INIT but before APOLLO_QUERY_STOP and APOLLO_QUERY_RESULT. And the result printed from console.log above is wrong: the same as the one on the first page.
Moreover I think it's weird thatAPOLLO_QUERY_INIT modify apollo/queries/0/variables/page from 1 to 2 (shouldn't it just append new queries: apollo/queries/1 instead of updating the existing one?).

More insight
Without refreshing the page, the same query is run again with even different $page variable (i.e. move to 3rd page). Now it prints correct result. Subsequent query also works correctly
