File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -55,16 +55,16 @@ class CreateLink extends Component {
5555 mutation = { POST_MUTATION }
5656 variables = { { description, url } }
5757 onCompleted = { ( ) => this . props . history . push ( '/new/1' ) }
58- update = { ( cache , { data : { post } } ) => {
58+ update = { ( store , { data : { post } } ) => {
5959 const first = LINKS_PER_PAGE
6060 const skip = 0
6161 const orderBy = 'createdAt_DESC'
62- const data = cache . readQuery ( {
62+ const data = store . readQuery ( {
6363 query : FEED_QUERY ,
6464 variables : { first, skip, orderBy }
6565 } )
6666 data . feed . links . unshift ( post )
67- cache . writeQuery ( {
67+ store . writeQuery ( {
6868 query : FEED_QUERY ,
6969 data,
7070 variables : { first, skip, orderBy }
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ class Link extends Component {
3535 < Mutation
3636 mutation = { VOTE_MUTATION }
3737 variables = { { linkId : link . id } }
38- update = { ( cache , { data : { vote } } ) =>
39- updateStoreAfterVote ( cache , vote , link . id )
38+ update = { ( store , { data : { vote } } ) =>
39+ updateStoreAfterVote ( store , vote , link . id )
4040 }
4141 >
4242 { voteMutation => (
Original file line number Diff line number Diff line change @@ -81,21 +81,21 @@ const NEW_VOTES_SUBSCRIPTION = gql`
8181`
8282
8383class LinkList extends Component {
84- _updateCacheAfterVote = ( cache , createVote , linkId ) => {
84+ _updateCacheAfterVote = ( store , createVote , linkId ) => {
8585 const isNewPage = this . props . location . pathname . includes ( 'new' )
8686 const page = parseInt ( this . props . match . params . page , 10 )
8787
8888 const skip = isNewPage ? ( page - 1 ) * LINKS_PER_PAGE : 0
8989 const first = isNewPage ? LINKS_PER_PAGE : 100
9090 const orderBy = isNewPage ? 'createdAt_DESC' : null
91- const data = cache . readQuery ( {
91+ const data = store . readQuery ( {
9292 query : FEED_QUERY ,
9393 variables : { first, skip, orderBy }
9494 } )
9595
9696 const votedLink = data . feed . links . find ( link => link . id === linkId )
9797 votedLink . votes = createVote . link . votes
98- cache . writeQuery ( { query : FEED_QUERY , data } )
98+ store . writeQuery ( { query : FEED_QUERY , data } )
9999 }
100100
101101 _getQueryVariables = ( ) => {
You can’t perform that action at this time.
0 commit comments