Code Monkey home page Code Monkey logo

gatsby-with-apollo's Introduction

Gatsby

Gatsby with Apollo

This is a minimal example of using Gatsby and Apollo together. It’s GraphQL all the way down! 🐒

gatsby-with-apollo's People

Contributors

jlengstorf avatar masadow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-with-apollo's Issues

Does this work with latest Gatsby?

[email protected] complains about any queries I have wrapped in graphql-tag for runtime Apollo queries at build time. e.g.

GraphQLDocumentError: Cannot query field "getCustomer" on type "Query".
        at /Users/benipsen/Development/moonshot-client/src/providers/AuthProvider.tsx:2:3

Any way to prevent Gatsby from doing this and just let alone the runtime queries?

Love the static builds Gatsby does, but this is for login / customer data.

CORS

FYI I added the isomorphic-fetch package and when I deploy it I get the CORS error:

blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Duplicate wrapRootElement

Hey there, thanks for this useful example!
Is there a reasons one should duplicate the wrapRootElement in both Browser and SRR js files or was it just to show both were possible?
I haven't found in the docs the difference between browser.js and srr.js could you point me to the right resource?
Thanks a lot!

Receive new data at Runtime - Question

Saw the code

// This query is executed at build time by Gatsby.
export const GatsbyQuery = graphql`
  {
    rickAndMorty {
      character(id: 1) {
        name
        image
      }
    }
  }
`;

The comment says query is executed at build time by Gatsby.

does this mean that if any new data is available in the backend it has to be re build again ? to receive the new data ?

Just wanted to ask a question because i didn't see any other ways to reach out. Sorry for cluttering the issues.

Client-side API timeout

Problem

When running the demo page I get stuck on "loading Sara" underneath the Rick and Morty meme.

Process to define problem

After running locally I got an error from Gatsby because there is no 404 page. After providing a dummy 404 page, I got the error that the API was timing out.

Possible Solution

Troubleshoot the reason for an API timeout on the server.

Steps already taken

I tried switching the API endpoint to a dummy endpoint and retrieving data and it worked just fine.

$Network request failed

Not sure what I am doing wrong. Forked the project, ran an npm install and ran npm start- pre-rendered content loads fine but the Apollo data does not. Instead the error variable spits out "$Network request failed". Tried changing API's aswell incase that was the issue. Same out come. Would appreciate any help or guidance- I really want to master Apollo + Gatsby.

(Please let me know what data I can share to make my problem more clear)

SSR For APollo Client an gatsby

Hi Bro I reallly Need your i implemented the gatsby with apollo client.. it works fine for client side but i want to show all the data to server side rendereing which can be seen in view source but how can i apply SSR for apollo client and gatsby please help me..
i created a folder by name apollo inside components and inside apollo folder i create two file client.js and wraproot element.js
see the screenshot
Client.js

image

Wrap-root-element.js
image

this is screenshot which i refered the code from your repo by i want to add SSR so that all the data can be view in view source please bro guide me to add SSR in this project i am stuck in this part since one month

What about running the same queries

Thanks for this demo guys. I'm running a similar setup. My challenge is, that I want to run the same kind of queries both in Gatsby and in ApolloClient. I want my search page to render the first 10 results from Gatsby, after that, the user can search and filter with live data via ApolloClient. Also, I have a client-only route fetching for an item that hasn't built yet. All of this works, if I set up 2 different queries. Because the shape is just a bit different. gatsby-source-graphql wraps the query with an extra something parent, typenames get prepended with SOMETHING_. This wouldn't be too bad if I could share the requested fields between the gatsby graphql``` and apolloClient gql``` but gatsby wont allow me to interpolate variables into the graphql block.

Hope anyone has any idea's to share more between the 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.