- Created addRecordInCache to inject a record in Apollo cache and inject single read query on this record - Created createOneRecordInCache and createManyRecordsInCache that uses this addRecordInCache - Created useOpenCreateActivityDrawerV2 hook to create an activity in cache and inject it into all other relevant requests in the app before opening activity drawer - Refactored DEFAULT_SEARCH_REQUEST_LIMIT constant and hardcoded arbitrary request limits - Added Apollo dev logs to see errors in the console when manipulating cache
19 lines
467 B
TypeScript
19 lines
467 B
TypeScript
import { useEffect } from 'react';
|
|
import { loadDevMessages, loadErrorMessages } from '@apollo/client/dev';
|
|
import { useRecoilValue } from 'recoil';
|
|
|
|
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
|
|
|
export const ApolloDevLogEffect = () => {
|
|
const isDebugMode = useRecoilValue(isDebugModeState);
|
|
|
|
useEffect(() => {
|
|
if (isDebugMode) {
|
|
loadDevMessages();
|
|
loadErrorMessages();
|
|
}
|
|
}, [isDebugMode]);
|
|
|
|
return null;
|
|
};
|