Fix circular structure error in useFetchMoreRecordsWithPagination (#13042)

Fixes:  
TypeError: Converting circular structure to JSON crashing opportunities
pagination.

Issue: 
useFetchMoreRecordsWithPagination was putting an Apollo client object in
React's dependency array. React tried to serialize it for memoization,
hit circular refs in InMemoryCache, and was throwing the error.

Fix: 
Removed unnecessary Apollo client import. The fetchMore from the
original useQuery is already bound to the correct client.

before: 


https://github.com/user-attachments/assets/0422c57b-5cd2-4c0f-9828-fb7bbd7f94c1

after:



https://github.com/user-attachments/assets/20112fb7-3990-4c34-bf39-8c53b7b48e45
This commit is contained in:
nitin
2025-07-05 01:23:18 +05:30
committed by GitHub
parent b24588d648
commit 1729970836
3 changed files with 2 additions and 12 deletions

View File

@ -1,5 +1,4 @@
import { useApolloFactory } from '@/apollo/hooks/useApolloFactory';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { ApolloCoreClientContext } from '../contexts/ApolloCoreClientContext';
@ -8,10 +7,7 @@ export const ApolloCoreProvider = ({
}: {
children: React.ReactNode;
}) => {
const apolloCoreClient = useApolloFactory({
uri: `${REACT_APP_SERVER_BASE_URL}/graphql`,
connectToDevTools: true, // @Felix I am not sure if this is correct, should be false?
});
const apolloCoreClient = useApolloFactory();
return (
<ApolloCoreClientContext.Provider value={apolloCoreClient}>