Giter Club home page Giter Club logo

guide's People

Contributors

dependabot[bot] avatar jeresig avatar lorensr 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

guide's Issues

CSS page sizing / zoom problem

Things are showing up as too many pixels for the device emulator. And then shrunk by chrome to fit device screen. Something to do with flexbox? Branch bug/pixels

image

Tag 3_0.0.3 StarCount.js should have polling removed

Not sure how precise these should be so happy to "tone it down" if this is not meaningful, however StarCount.js's polling mechanism should be disabled in 3_0.0.3 onward due to the subscription work put in place.

If you should like this level of detail, is there a decent way of issuing these small changes against their tags (and the rest of the steps too then when relevant)? The workflow as a reader is pretty nice, but curious how as an author what the flow would be to patch all the rest.

Write PropTypes.* or import bool, string, etc?

import { bool, string } from 'prop-types'

Component.propTypes = {
  loading: bool.isRequired,
  name: string.isRequired
}

// or current method:

import PropTypes from 'prop-types'

Component.propTypes = {
  loading: PropTypes.bool.isRequired,
  name: PropTypes.string.isRequired
}

Pagination: limit vs first

My sense is non-graphql people are more familiar with skip & limit vs offset & first? graphql.org, relay, and prisma use the latter

Pause StaggeredMotion animation until browser in view

Current bug behavior:

  • open graphql.guide in a new tab that doesn't have focus (eg by cmd-clicking a link)
  • wait 10s
  • switch to the new tab. you'll see an empty page with just:

image

because the StaggeredMotion animation trigger doesn't wait while the page isn't focused, whereas GSAP TimelineLite does wait.

Beta email list

  • create new branch feature/betalist
  • whenever you'd like me to take a look at your work, open a PR from that branch to master

Add notifyOnNetworkStatusChange

Waiting on: apollographql/react-apollo#2324

Branch 8, after Now we’ve got login working.

export const withUser = graphql(USER_QUERY, {
  options: { notifyOnNetworkStatusChange: true },
  props: ({ data: { currentUser, loading } }) => ({
    user: currentUser,
    loggingIn: loading
  })
})

On mobile, delay animations

Currently all animations but header and first paragraph you don't see on mobile because they're below the fold. Would be nice if the animations were triggered by scrolling.

@hakimelek interested?

Receive `TypeError: Cannot read property 'section' of undefined` when running server on 5_0.0.3

When running the project from a fresh clone I receive the following error in the browser:

TypeError: Cannot read property 'section' of undefined
options
src/components/Section.js:51
  48 | `
  49 | 
  50 | const withData = graphql(SECTION_QUERY, {
> 51 |   options: ({ location: { state: { section: { id } } } }) => ({
  52 |     variables: { id }
  53 |   }),
  54 |   props: ({ data: { section, loading } }) => ({
View compiled
▶ 18 stack frames were collapsed.
./src/index.js
src/index.js:39
  36 | 
  37 | const client = new ApolloClient({ link, cache })
  38 | 
> 39 | ReactDOM.render(
  40 |   <BrowserRouter>
  41 |     <ApolloProvider client={client}>
  42 |       <App />

Steps to Reproduce

  1. git clone [email protected]:GraphQLGuide/guide.git guide-clean
  2. cd guide-clean
  3. git checkout 5_3.0.3
  4. npm install
  5. npm start
  6. Observe error in browser

I've spent a couple of hours trying to debug it with no luck, and sort of stuck running through the rest of the book that I purchased. Checking out the next chapter at 6_0.0.3 everything works fine again.

Websocket connection fails

Firefox can't establish a connection to the server at wss://api.graphql.guide/subscriptions.

image

Thanks @zenweasel for reporting. If anyone else runs into this, let us know your environment and if you have any ideas on what might be causing it ☺️

Put secretKey inside CreateUserInput?

We say it's best practice to use a single input type as an argument, and then we do this:

type Mutation {
  createUser(user: CreateUserInput!, secretKey: String!): User
}

I created it that way because secretKey felt like something out of band, like you'd put it in a header, except it's more convenient to be an argument given it's only used in this one resolver. Is that a good reason, in which case we could add an explanation, or should we just move it inside the input object like this?

input CreateUserInput {
  firstName: String!
  lastName: String!
  username: String!
  email: String!
  authId: String!
  secretKey: String!
}

Thanks to @Borales for asking

Redesign

Header moved to left side of screen, full screen height. Same animation order. First two:

image

Current:

image

Tag 3_0.0.3 does not include relevant library functions

Chapter 6, Section 2 references 3_0.0.3 tag as it's basis for work. Under this section, for the TableOfContents evolution, there are references to the lib/helpers for slugify method. This file however is not included in the source code at this point and is introduced later on in 4_0.0.3.

Should bring that file into the source tree for 3_0.0.3 to allow users to evolve the app in lock-step with the book.

A/B test package order

Currently Training is kept in first row on smaller screens as a price anchor. Test if that has any difference compared to traditional increasing-price order.

Get rid of withAuth?

Made withAuth to not have to mess with <App> and give example of making HOC. Not feeling like either reason is very important.

Globals?

Inspired by DHH's series on writing software well, in an episode recommending judicious use of globals, eg for the current user.

Could be used for login/logout functions.

  • Pro: Easy
  • Con: Testing—for various forms of testing (including explicit unit tests and things like storybook), you then have to mock out the globals.
// CurrentUserQuery.js
export let login, logout

class CurrentUserQuery extends Component
  constructor() {
    login = this.login
    logout = this.logout      
  }

  login = () => 
  logout = () => 

So that eg in Profile.js you can:

import { login, logout } from './CurrentUserQuery'

instead of getting them as props.

Prop drilling vs HOC vs Context/unstated

Need a reactive data source for loading & currentUser, so can't do globals.

Reusable query

Could do a withUser() HOC that provides them through graphql() to any component that needs it. All using default cache-first, and deduplication should combine them into one query, while also maintaining data.loading/loadingUser.

  • Pro: concise. Using Apollo store like the global variable it is
  • Con: how to incorporate loggingIn into loading? In the single-use withAuth, it's defined as: loading={loading || this.state.loggingIn}
class Profile extends Component {
  ...
}

export default withUser(Profile)

(or alternatively could make a reusable <WithUser> query component, but that takes more characters and indentation to use)

Prop drilling

A single normal query at the top. Lot of drilling. It's nice for testing, but not nice to read/write. Would personally prefer to avoid.

<CurrentUserQuery>
  {({ loading, error, data }) => (
    <App loadingUser={loading} currentUser={data.currentUser} />
  )}
</CurrentUserQuery>

Context/unstated

  • Pro: no drilling
  • Con: verbose

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.