Code Monkey home page Code Monkey logo

the-road-to-graphql / react-graphql-github-apollo Goto Github PK

View Code? Open in Web Editor NEW
1.6K 38.0 223.0 3.04 MB

๐Ÿš€ A React + Apollo + GraphQL GitHub Client. Your opportunity to learn about these technologies in a real world application.

Home Page: https://www.robinwieruch.de/react-with-graphql-tutorial

HTML 3.78% CSS 12.02% JavaScript 84.20%
react graphql apollo apollo-client apollographql react-apollo react-router-v4 github github-api github-client

react-graphql-github-apollo's Introduction

A React + Apollo + GraphQL GitHub Client

Build Status Slack Greenkeeper badge

Features

  • React 16 with create-react-app
  • Responsive
  • React Router 4
  • Apollo with GitHub GraphQL API
    • Queries and Mutations with render props
    • Optimistic Updates
    • Pagination
    • Optimistic Fetch (e.g. Issues)
      • not everywhere for the purpose of demonstrating though

Installation

  • git clone [email protected]:the-road-to-graphql/react-graphql-github-apollo.git
  • cd react-graphql-github-apollo
  • add your own GitHub personal access token in a .env file in your root folder
    • scopes/permissions you need to check: admin:org, repo, user, notifications
    • REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN=xxxXXX
  • npm install
  • npm start
  • visit http://localhost:3000

Contributing

Want to learn more about React + GraphQL + Apollo?

react-graphql-github-apollo's People

Contributors

austingreen avatar greenkeeper[bot] avatar rwieruch 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  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

react-graphql-github-apollo's Issues

process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN produces undefined

const httpLink = new HttpLink({
uri: 'https://api.github.com/graphql',
headers: {
authorization: Bearer ${ process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN },
},
});

The process.env code is unreliable and for me on slower browsers I get an UNDEFINED...

When I replace that code with the solution below it all works.
It is possible that I may be the only one seeing an issue with this...
And if that is the case then your solution works great !

However, in doing some research on the internet I have noticed other people's issues
with Webpack, process.env etc...

I have implemented what I believe to be a much more robust solution for getting the
github-auth-token

You can check it out....
If you like the idea we can scope out me doing a pull request to change the current implementation.

Here is an explanation of my change.

https://github.com/stormasm/garg/blob/master/Readme.md

We could come up with a design where the user simply has to edit a file
we have already created and pop in their github-auth-token...

About as simple as having to edit an ENVIRONMENT variable.

The other solution might be to wrap that code in an async / wait...
But that seems way more complicated...
Curious to know what others think...

Thanks,
Michael

TypeError: Cannot read property 'viewer' of undefined.

When component did mount, there is no value in { data } returned from component. So, it generates a TypeError: Cannot read property 'viewer' of undefined.

const Profile = () => (

{({ data, loading }) => {
const { viewer } = data;
if (loading || !viewer) {
return

Loading ...
;
}
return (

{viewer.name} {viewer.login}

)
}}

);

Feature: add a comment to an issue

It should be possible to add a comment to the list of comments in issues. If there are "No more comments" via Pagination, there should be an input field to add a comment. In order to add a comment, the addComment from the GitHub GraphQL API can be used.

screen shot 2018-02-05 at 11 12 20

Search in issues of a specific repository

Hi all,

First of all, this is a great repo that helped me with getting started with React, Apollo, and GraphQl.

Probably its more of a GitHub GraphQL API related question. Based on this repo, I'm trying to create a demo app that will allow the user to search issues of a specific repository. I was able to list issues of a specific repository. But I couldn't find information on how to search issues of a specific repository. There's a top level search option but it gets results from all repositories.

It'd be very helpful if anyone can give me some clue

Feature: add deployment option

It would be great to have a deployment option for devs who might want to get this up quickly (for prototyping reasons for example). That's why I would suggest to add a quick and painless deployment option like Zeit Now for instance.

I hope this issue can add some value ๐Ÿ˜„

Thanks

Queries (2nd load)

@rwieruch Very good example, thanks for sharing. I have a question regarding Queries, for example RepositoriesList or IssueList, and pagination.
The first time the view mounted the query retrieves 5 entries, and with fetchMore we can load another bunch of 5 entries. Nevertheless, the second time mounted the view (or any successive) the query gets from the store and shows all the entries requested before.
Is it possible to have the same user experience than in the initial case? I mean, still using the data in the store but pulling the first bunch.

CSS-in-JS

Hi Robin, this looks awesome. Would you consider converting your CSS into styled-components? Including layout components with Grid Layout and Flexbox?
Cheers :)

Add Prettier

It would be great to follow a unified code style in the repository for people contributing to it. That's why I would propose Prettier for it. Even though everyone has to install it on their own, there are a couple of things that would help people to get started.

  • add a Prettier configuration file to the project (e.g. with dangling comma true, semicolons true)

  • add a "prettier" script to the scripts package.json block to format all files via the command line. This can be done one time initially to have a unified code style.

  • add a Contribution section at the bottom of the README.md mentioning to install a Prettier editor/IDE integration (e.g. VS Code) and to enforce it on save file (e.g. VS Code).

Star count not updated

Hello,

Thanks for this course.

When I 'Star' a repo using this app, the app doesn't show the updated star count until I relaunch the app. Is this the expected behavior?

I thought I had a bug in my code and so checked the behavior of this repo.

EDIT: Oops, I just noticed the note about this on page 127 of the book. I'll close this issue.

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.