Fix/apollo client spamming infinite requets on failure (#450)

* Remove abort controller by default from requests

Apollo client is, for whatever reason, considering it a new hook call when passing an abort controller to be passed to the actual request.
On request failures this then causes infinite requests due to it being a new hook call.

* Move side effect into useEffect

This was missed and started causing issues after the changes of 60429d9d98544e1e49a112aacf77bdbb831740ec.
Due to the changes, the component did not re-render unnecessarily which caused the component not to re-render with the fetched data

* Reset fetching initial pages state

The state was never reset, thus, in case of an error, the initial pages fetch was never triggered again
This commit is contained in:
schroda
2023-11-11 23:42:58 +01:00
committed by GitHub
parent 291e1899f9
commit 345fbcb5c7
3 changed files with 23 additions and 14 deletions

View File

@@ -108,7 +108,6 @@ export const Updates: React.FC = () => {
} = requestManager.useGetRecentlyUpdatedChapters(undefined, {
fetchPolicy: 'cache-and-network',
notifyOnNetworkStatusChange: true,
omitAbortSignal: true,
});
const hasNextPage = !!chapterUpdateData?.chapters.pageInfo.hasNextPage;
const endCursor = chapterUpdateData?.chapters.pageInfo.endCursor;