question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Expose graphql source query.

See original GitHub issue

Summary

At prismic we have a use-case for re-running a graphql source query during runtime and would like to know if there is an already existing solution to exposing the source-query or make a feature request.

Our main use-case is to re-run the query at run-time in-order to make preview work. see example below:

import { StaticQuery, graphql } from 'gatsby';
import { withPreview } from 'gatsby-source-prismic-graphql';

const articlesQuery = graphql`query { prismic { ... } }`;

export const Articles = () => (
  <StaticQuery query={articlesQuery} render={withPreview(data => { ... }, articlesQuery)} />
);

Basic example

Our current solution involves patching the babel-plugin-remove-graphql with this https://github.com/birkir/gatsby-source-graphql-universal/blob/master/scripts/patches/babel-plugin-remove-graphql-queries.patch But this patch breaks useStaticQuery site-wide.

Motivation

Why are we doing this?

  • We do this to provided a better user experience when using our preview feature

What use cases does it support?

  • Fetching and using data from a content management service client side.

What is the expected outcome?

  • Alternative methods to achieve these same goals.
  • or expose the graphql query source so it can be re-run

We would be happy to make a PR to enable this feature.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
github-actions[bot]commented, May 24, 2020

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Simple Ways to Call a GraphQL API
GraphQL IDEs let you build queries, browse schemas, and test out GraphQL APIs. Apollo Explorer is a free cloud-based GraphQL IDE that comes...
Read more >
GraphQL Best Practices
A query language for your API — GraphQL provides a complete description of the data in your API, gives clients the power to...
Read more >
Expose REST APIs as GraphQL
GraphQL is a typed query language for APIs that allows you to fetch data for your application with rich, descriptive queries. Your API...
Read more >
Feature Request: graphql Server Chaining · Issue #4
A apollo server would expose a graphql endpoint to query and mutate these users. An app server then needs to query this database...
Read more >
GraphQL is not meant to be exposed over the internet
The GraphQL spec allows us to define multiple Operations (Queries, Mutations, Subscriptions) in a single GraphQL document. In addition to this, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found