#here s the request
1 messages · Page 1 of 1 (latest)
Hi @runic atlas. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
did it work before or are you still working on it?
Sorry @runic atlas, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
piss off bot
generated file just never gets updates and documents is always = []
types work just fine tho
query generation never worked(
heres my config
import type { CodegenConfig } from '@graphql-codegen/cli'
const url = process.env.STRAPI_API_URL as string;
const xApiKey = process.env.STRAPI_API_KEY as string;
const config: CodegenConfig = {
// schema: [
// {
// [url]: {
// headers: {
// "x-api-key": xApiKey,
// },
// },
// },
// ],
schema: url,
documents: ["app/**/*.{ts, tsx}", "app/*.{ts, tsx}"],
ignoreNoDocuments: true,
generates: {
"./gql/": {
preset: "client",
plugins: [],
},
},
};
export default config
same X_X
yeah, useQuery complains all the time, likely because it doesnt get its types generated, and isnt happy with the unknown
i know nextjs has an example repo with graphql an stuff
what is the complaint?
like what error?
ah yea like that
they have graphql but dont use codegen( I got it all working fine if I dont use codegen and rely entirely on apollo for requests without codegen wrapper
and running graphql-codegen works right?
yeah, no problem there, updates types perfectly fine, just the queries that stay empty, i.e. gql never gets updated and documents always stay = []
nah, internal stuff X_X
its ok, hopefully someone else wanders in:D
thanks for this tho, helps to talks it out at least
just wondering what is the contents of '../../gql/gql' is that the codegen script?
what it generates by default
/* eslint-disable */
import * as types from './graphql';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
const documents = [];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*
*
* @example
* ``ts
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
* ``
*
* The query argument is unknown!
* Please regenerate the types.
*/
export function graphql(source: string): unknown;
export function graphql(source: string) {
return (documents as any)[source] ?? {};
}
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;