Files
pentagi/frontend/graphql-codegen.ts
T
Sergey Kozyrenko 962e648fe1 refactor(webui): migrate to Apollo Client v4 typed-document-node codegen
Replace the deprecated typescript-react-apollo codegen plugin (unmaintained for Apollo Client v4) with typed-document-node. All ~105 useXxxQuery/Mutation/Subscription call sites are rewritten to the generic useQuery/useMutation/useSubscription(XxxDocument, ...) form, with skipToken replacing skip + conditional-variables.

graphql-codegen.ts: plugins typescript-operations + typed-document-node; add scalars { Time: string } (was unknown); drop withHooks/apolloReact* options. tsconfig.app/node.json: ignoreDeprecations "6.0" for the baseUrl TS5101 deprecation. Regenerate src/graphql/types.ts.

Behavior-preserving: variables, fetchPolicy, error handling, and subscription onData/refetchQueries are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 16:07:57 +07:00

26 lines
760 B
TypeScript

import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
documents: './graphql-schema.graphql',
generates: {
'./src/graphql/types.ts': {
config: {
dedupeFragments: true,
enumType: 'native',
exportFragmentSpreadSubTypes: true,
inlineFragmentTypes: 'combine',
scalars: { Time: 'string' },
skipTypename: true,
useTypeImports: true,
},
plugins: ['typescript-operations', 'typed-document-node'],
},
},
hooks: {
afterOneFileWrite: ['npx prettier --write'],
},
schema: '../backend/pkg/graph/schema.graphqls',
};
export default config;