File tree Expand file tree Collapse file tree 7 files changed +47
-12
lines changed
Expand file tree Collapse file tree 7 files changed +47
-12
lines changed Original file line number Diff line number Diff line change 1+ 1.6.0 - 2017-06-06
2+ ------------------------------------------------
3+
4+ ## GraphQL
5+ * Adds `graphql-tag` loader, for storing queries in `.gql|graphql` files (closes #32)
6+ * Refactors `src/app.js` to use file queries
7+ * Adds `src/queries/all_messages.gql`, for retrieving GraphCool endpoint messages
8+ * Adds `src/queries/message.gql`, imported by `all_messages.gql` as a query fragment
9+
10+ ## Webpack
11+ * Adds `graphql-tag` loader config to `kit/webpack/base.js`
12+
13+ ## NPM
14+ * Adds packages:
15+ "graphql-tag": "^2.2.1"
16+
1171.5.3 - 2017-06-06
218------------------------------------------------
319
Original file line number Diff line number Diff line change @@ -63,6 +63,13 @@ export default new WebpackConfig().merge({
6363 } ,
6464 } ,
6565
66+ // GraphQL queries
67+ {
68+ test : / \. ( g r a p h q l | g q l ) $ / ,
69+ exclude : / n o d e _ m o d u l e s / ,
70+ loader : 'graphql-tag/loader' ,
71+ } ,
72+
6673 // Images. By default, we'll just use the file loader. In production,
6774 // we'll also crunch the images first -- so let's set up `loaders` to
6875 // be an array to make extending this easier
Original file line number Diff line number Diff line change 4848 "eslint-plugin-react" : " ^7.0.1" ,
4949 "extract-text-webpack-plugin" : " ^2.1.0" ,
5050 "file-loader" : " ^0.11.1" ,
51+ "graphql-tag" : " ^2.2.1" ,
5152 "html-webpack-plugin" : " ^2.28.0" ,
5253 "image-webpack-loader" : " ^3.3.1" ,
5354 "less" : " ^2.7.2" ,
Original file line number Diff line number Diff line change 11// ----------------------
22// IMPORTS
33
4+ /* NPM */
5+
46// React
57import React from 'react' ;
68import PropTypes from 'prop-types' ;
79
810// GraphQL
9- import { gql , graphql } from 'react-apollo' ;
11+ import { graphql } from 'react-apollo' ;
1012
1113// Routing
1214import {
@@ -18,9 +20,14 @@ import {
1820// <Helmet> component for setting the page title
1921import Helmet from 'react-helmet' ;
2022
23+ /* Local */
24+
2125// NotFound 404 handler for unknown routes
2226import { NotFound , Redirect } from 'kit/lib/routing' ;
2327
28+ // GraphQL queries
29+ import allMessages from 'src/queries/all_messages.gql' ;
30+
2431// Styles
2532import './styles.global.css' ;
2633import css from './styles.css' ;
@@ -79,20 +86,10 @@ const Stats = () => {
7986
8087// Now, let's create a GraphQL-enabled component...
8188
82- // First, create the GraphQL query that we'll use to request data from our
83- // sample endpoint
84- const query = gql `
85- query {
86- allMessages(first:1) {
87- text
88- }
89- }
90- ` ;
91-
9289// ... then, let's create the component and decorate it with the `graphql`
9390// HOC that will automatically populate `this.props` with the query data
9491// once the GraphQL API request has been completed
95- @graphql ( query )
92+ @graphql ( allMessages )
9693class GraphQLMessage extends React . PureComponent {
9794 static propTypes = {
9895 data : PropTypes . shape ( {
Original file line number Diff line number Diff line change 1+ #import "./message.gql"
2+
3+ query AllMessages {
4+ allMessages (first :1 ) {
5+ ... Message
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ fragment Message on Message {
2+ text
3+ }
Original file line number Diff line number Diff line change @@ -3315,6 +3315,10 @@ graphql-tag@^2.0.0:
33153315 version "2.2.0"
33163316 resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.2.0.tgz#9ea24f35a19aab1be1e55675928344d84d852905"
33173317
3318+ graphql-tag@^2.2.1 :
3319+ version "2.2.1"
3320+ resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.2.1.tgz#1da61feb6c6fc119ee8c579c4de424d389bee0c2"
3321+
33183322graphql@^0.10.0 :
33193323 version "0.10.1"
33203324 resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.1.tgz#75c93c2ce73aeb5bae2eefb555a8e9e39c36027d"
You can’t perform that action at this time.
0 commit comments