Open adriangalilea opened 3 weeks ago
Inconvenient solution: if I create the query elsewhere and import it the issue disappears.
I'm having a similar problem, but in Vue. Here's an example -- about as bare-bones as one can get for the fragments approach.
<script setup lang="ts">
import { computed } from "vue"
import { gql, useFragment, type FragmentType } from "~typedgql"
const conversationFragment = gql(/* GraphQL */ `
fragment ConversationHeader_ConversationFragment on Conversation {
subject
}
`)
const props = defineProps<{
conversation: FragmentType<typeof conversationFragment>
}>()
const conversation = computed(() => useFragment(conversationFragment, props.conversation))
</script>
<template>
<h2>{{ conversation.subject }}</h2>
</template>
I managed to find out more about it, and it's likely a separate problem, filed here: https://github.com/dotansimha/graphql-code-generator/issues/10127
Which packages are impacted by your issue?
@graphql-codegen/core
Describe the bug
I want to preface this by saying that I won't provide a repro URL, I don't have the time to so, feel free to close it.
However I crated this mockup code in order to illustrate what the issue is:
When I have a query inside of a function where some of the fields are used but the rest are simply returned, I get tons of
Field(s) ... are not used.
warnings for the fields that are returned to use externally but are not used internally.It happens for all the fields that I don't access inside the function.
I can't tsignore anything inside
graphql(...)
so I have no idea how to fix it.Codegen Config File