Hello everyone,
I followed the tutoriel React/Apollo and I faced some refresh issue with this project:
So is it a normal case with apollo ? do we need to have a useEffect hook in linklist.js like the code bellow ? The hook useQuery does not rerender the component in such cases ? or is it a problem with the InMemoryCache ?
(even in the apollo dev tools extension, the parameters variables for the FETCH Query seems not changing at all)
const history = useHistory();
const isNewPage = history.location.pathname.includes("new");
const pageIndexParams = history.location.pathname.split("/");
const page = parseInt(pageIndexParams[pageIndexParams.length - 1]);
const pageIndex = page ? (page - 1) * LINKS_PER_PAGE : 0;
const { data, loading, error, subscribeToMore, refetch } = useQuery(
FEED_QUERY,
{
variables: getQueryVariables(isNewPage, page),
}
);
useEffect(() => {
console.log("refetch");
refetch();
}, [page]);
Hello everyone,
I followed the tutoriel React/Apollo and I faced some refresh issue with this project:
First when you log in , the Header seems not rerendered (you don't have the submit button even if you're logged in , see the image below, you can see that you are logged in cause you see the vote below links)

Then it seems that the pagination (or the data fetch by the query is not working well, or need to be refetched when page in URL change ?) - in my dataset I have 6 links



First you are on the page one, you can see 5 links (normal behavior)
Then you click on the next page on you see a new link (based on the pagination system , normal behavior)
If you hit again previous button, there is on the page only one link (and not the 5 previous one , bug)
So is it a normal case with apollo ? do we need to have a useEffect hook in linklist.js like the code bellow ? The hook useQuery does not rerender the component in such cases ? or is it a problem with the InMemoryCache ?
(even in the apollo dev tools extension, the parameters variables for the FETCH Query seems not changing at all)