Skip to content

Commit

Permalink
fix react-apollo issue apollographql/react-apollo#826 duplicate name …
Browse files Browse the repository at this point in the history
…of variables;fix button style;set query fetch-policy;fix select component style
  • Loading branch information
KennethMa committed Jul 17, 2017
1 parent ffc3bc8 commit ec8f99f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
5 changes: 1 addition & 4 deletions components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import styled from 'styled-components'

export default styled.button`
text-align: center;
-moz-appearance: none;
-webkit-appearance: none;
-webkit-box-align: center;
Expand All @@ -14,9 +15,6 @@ export default styled.button`
display: -ms-inline-flexbox;
display: inline-flex;
font-size: inherit;
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
line-height: 1.5;
padding-bottom: calc(0.375em - 1px);
padding-left: calc(0.625em - 1px);
Expand All @@ -33,7 +31,6 @@ export default styled.button`
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
text-align: center;
white-space: nowrap;
width: ${props => props.refresh || props.primary ? '100%' : 'auto'};
height: ${props => props.refresh ? '100%' : '0.875rem'};
Expand Down
6 changes: 5 additions & 1 deletion components/PrizeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ function PrizeList ({ data: { loading, error, prize }, onRefresh}) {
}

export default compose(
graphql(PrizeListQuery),
graphql(PrizeListQuery, {
options: () => ({
fetchPolicy: 'network-only',
}),
}),
graphql(GetNumberMutation, {
props: ({ ownProps, mutate }) => ({
onRefresh: type => mutate({ variables: { type } }),
Expand Down
1 change: 1 addition & 0 deletions components/PrizeNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default ({ data, onRefresh }) => (
border-radius: 50%;
line-height: 0.7813rem;
font-size: 15px;
color: #fff;
}
.item_numlist-item:not(:first-child) {
Expand Down
2 changes: 1 addition & 1 deletion components/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const StyledSelect = styled.select`
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
font-size: inherit;
font-size: 0.375rem;
height: 0.8281rem;
-webkit-box-pack: start;
-ms-flex-pack: start;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js"
"start": "NODE_ENV=production node server.js",
"postinstall": "rimraf node_modules/react-apollo/node_modules/react-dom"
},
"dependencies": {
"babel-plugin-styled-components": "^1.1.5",
Expand Down
8 changes: 4 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ const handle = app.getRequestHandler()

app.prepare()
.then(() => {
const app = express()
const server = express()

app.use('/graphql', expressGraphQL(req => ({
server.use('/graphql', expressGraphQL(req => ({
schema,
graphiql: dev,
rootValue: { request: req },
pretty: dev,
})));

app.get('*', (req, res) => {
server.get('*', (req, res) => {
return handle(req, res)
})

app.listen(3000, (err) => {
server.listen(3000, (err) => {
if (err) throw err
console.log('> Ready on http://localhost:3000')
})
Expand Down

0 comments on commit ec8f99f

Please sign in to comment.