Skip to content

Add option to pluck raw GraphQL from custom Vue block #4320

@jaschaephraim

Description

@jaschaephraim

Is your feature request related to a problem? Please describe.

I'd like to pluck raw GraphQL from a custom Vue block:

<template>
  <div>{{data.record}}</div>
</template>

<script setup lang="ts">
import { useGetRecordQuery } from '@/generated/graphql';

const { data } = useGetRecordQuery();
</script>

<graphql lang="gql">
query GetRecord {
  record {
    id
    name
  }
}
</graphql>

Describe the solution you'd like

Because the necessary work is already being done by the Vue parser, this feature adds useful functionality with minimal impact on the code. I have a branch ready to submit as a PR, I'm very open to suggestions regarding implementation and code style: jaschaephraim@c98d5c9?diff=split

It adds an option gqlVueBlock (defaults to undefined) to specify the name of a custom block you'd like plucked as raw GraphQL.

Describe alternatives you've considered

There's no other way I've found to do this using graphql-tag-pluck, and I'd ultimately like use this feature with graphql-code-generator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions