Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working up towards 2.0 release #2281

Merged
merged 43 commits into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a093162
Fix argument for fragment matcher
Oct 11, 2017
886f028
chore: Publish
Oct 11, 2017
68c6ce7
support conditional refetches
Oct 11, 2017
b67367c
ensure network requests are handled on errors with cache-and-network
Oct 11, 2017
26e0141
make cache easier to access for SSR
Oct 11, 2017
f077137
fix failing test from cache placement addition
Oct 11, 2017
69d4275
add test for multiple requests in flight at once
Oct 11, 2017
7d06fa6
remove direct dep on graphql
Oct 11, 2017
c337992
remove connection directive before sending to link
Oct 11, 2017
620ff77
chore: Publish
Oct 11, 2017
61a5c3d
handle unhanlded errors on polling queries
Oct 11, 2017
24a2ed3
chore: Publish
Oct 11, 2017
0a99d01
customResolvers => cacheResolvers
Oct 11, 2017
5c5c24f
micro benchmarking and reduction of mutation calls for perf gains
Oct 11, 2017
c71dc37
changelog
Oct 11, 2017
f52fe4e
Merge branch 'master' into 2.0
Oct 11, 2017
0540861
Merge branch '2.0' of https://github.com/apollographql/apollo-client …
Oct 11, 2017
7e197fc
remove warning for refetching unfetched queries
Oct 11, 2017
9f69e9d
chore: Publish
Oct 11, 2017
66e266a
prep for rc
Oct 11, 2017
368ad36
Publish
Oct 11, 2017
c9c642d
fix renrender bug
Oct 11, 2017
fe21ee2
put back in skipped test
Oct 11, 2017
070f5e0
chore: Publish
Oct 11, 2017
f5dd896
added new rawRequest method for devTool support
Oct 12, 2017
ae0d236
chore: Publish
Oct 12, 2017
f023720
fix subscribeToMore
Oct 12, 2017
4ef4a30
Merge branch 'master' into 2.0
Oct 12, 2017
e4c61ad
Define and expose ApolloClientOptions (#2292)
kamilkisiela Oct 12, 2017
a63e3f8
Merge branch 'master' into 2.0
Oct 13, 2017
bd3a720
fix ts bug
Oct 13, 2017
dd6130c
move off of custom zen-observable impl
Oct 13, 2017
220f781
changed to named exports
Oct 13, 2017
4dd2e4d
move to named imports from package changes
Oct 13, 2017
21d3b71
turn back on testing
Oct 13, 2017
80b0e8f
chore: Publish
Oct 13, 2017
0cce1f4
add a couple tests for open issues
Oct 13, 2017
d555953
Expose ApolloCurrentResult (#2301)
kamilkisiela Oct 15, 2017
91f5116
Merge branch 'master' into 2.0
Oct 16, 2017
92d743b
Merge branch 'master' into 2.0
Oct 17, 2017
eeb27f3
docs(cache): added readme for apollo-cache-inmemory (#2331)
peggyrayzis Oct 18, 2017
d1be76a
fix(client): throw error if constructor not initialized properly (#2332)
peggyrayzis Oct 19, 2017
816a61d
[WIP] 2.0 docs (#2324)
Oct 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ yarn.lock

# npm
package-lock.json

# docs
db.json
*.log
docs/public/*
!docs/public/_redirects
.idea/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "docs/themes/meteor"]
path = docs/themes/meteor
url = https://github.com/meteor/hexo-theme-meteor.git
23 changes: 12 additions & 11 deletions Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ If you are interested in contributing to the 2.0 release that is SO great!! Ther
## Installation instructions
The 2.0 of apollo is split into a few packages. To try it out in your app you can install the following
```bash
npm i --save apollo-client@beta apollo-cache-inmemory@beta apollo-link-http@beta
npm i --save apollo-client@next apollo-cache-inmemory@next apollo-link-http
```

This will give you the replacement for networkInterfaces (links), the current apollo-cache (cache-inmemory) and the new client.
Expand Down Expand Up @@ -83,16 +83,16 @@ import { onPageLoad } from 'meteor/server-render';

// apollo imports
import ApolloClient from 'apollo-client';
import Link from 'apollo-link-http';
import Cache from 'apollo-cache-inmemory'
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory'
import { ApolloProvider } from 'react-apollo';

import { App } from '/imports/app';

export const start = () => {
const client = new ApolloClient({
link: new Link({ uri: 'http://localhost:3000' }),
cache: new Cache().restore(window.__APOLLO_STATE__),
link: new HttpLink({ uri: 'http://localhost:3000' }),
cache: new InMemoryCache().restore(window.__APOLLO_STATE__),
});

const WrappedApp = (
Expand Down Expand Up @@ -128,20 +128,22 @@ becomes

```js
import ApolloClient from "apollo-client";
import InMemoryCache from "apollo-cache-inmemory";
import { InMemoryCache } from "apollo-cache-inmemory";

const cache = new InMemoryCache({
fragmentMatcher: // matcher,
dataIdFromObject: // custom function,
addTypename: true,
customResolvers: // custom resolvers
cacheResolvers: // cache resolvers
});

const client = new ApolloClient({
cache: cache.restore(window.__APOLLO_STATE__ || {})
});
```

*Note* If you were using `customResolvers`, the name of that has been changed to be `cacheResolvers` to be more descriptive of what it does. `customResolvers` will still be supported throughout the 2.0 though to be backwards compatible and ease the upgrade path


If you have previously used `getInitialState` for SSR, that API has been moved to the cache itself instead of on the client. The before:

Expand All @@ -159,14 +161,13 @@ becomes

```js
import ApolloClient from "apollo-client";
import InMemoryCache from "apollo-cache-inmemory";
import { InMemoryCache } from "apollo-cache-inmemory";

const cache = new InMemoryCache();
const client = new ApolloClient({ cache });
const client = new ApolloClient({ cache: new InMemoryCache() });

// do some data loading things using getDataFromTree

const state = cache.extract();
const state = client.cache.extract();
```


Expand Down
14 changes: 14 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# docs

[![Greenkeeper badge](https://badges.greenkeeper.io/apollographql/core-docs.svg)](https://greenkeeper.io/)

To run:

```
git submodule init
git submodule update
cd code && npm install
cd ..
npm install
npm start
```
125 changes: 125 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Hexo Configuration
## Docs: http://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Apollo Client Guide
propertytitle: Using GraphQL with Apollo Client
subtitle: React Guide
description: A guide to using the Apollo GraphQL Client with React.
author:
language:
timezone:
versions:
- '1'

# This setting also defines the page order used to generate the Previous/Next links at the bottom of each page
sidebar_categories:
# Basics
null:
- index
- basics/integrations
- basics/setup
- basics/queries
- basics/mutations
- basics/network-layer
- basics/error-handling
- basics/fragments
- basics/subscriptions
Features:
- features/changelog
- features/caching
- features/developer-tooling
- features/network-customization
- features/optimistic-ui
- features/react-native
- features/static-typing
Recipes:
- recipes/authentication
- recipes/babel
- recipes/meteor
- recipes/pagination
- recipes/prefetching
- recipes/query-splitting
- recipes/server-side-rendering
- recipes/simple-example
- recipes/webpack
# - recipes/client-side-data
# - recipes/using-with-rest
# - recipes/offline
# - recipes/custom-fetching
Reference:
- reference/index


github_repo: apollographql/apollo-client
content_root: docs/source

social_links:
github: 'https://github.com/apollographql'
twitter: '@apollographql'

# API keys
apis:
segment: wgrIo8Bul0Ujl8USETG3DB6hONdy4kTg
gtm: GTM-PNFDVBB

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.apollographql.com/docs/react
root: /docs/react/
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public/docs/react
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: true
tab_replace:

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: meteor

# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type:
1 change: 1 addition & 0 deletions docs/assets/theme-colors.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@color-primary: #22A699;
23 changes: 23 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.3.8"
},
"dependencies": {
"hexo": "3.3.8",
"hexo-generator-archive": "^0.1.2",
"hexo-generator-category": "^0.1.2",
"hexo-generator-index": "^0.2.0",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.2.0",
"hexo-renderer-less": "^0.2.0",
"hexo-renderer-marked": "^0.2.4",
"hexo-server": "^0.2.0"
},
"scripts": {
"build": "hexo generate",
"start": "hexo serve"
}
}
1 change: 1 addition & 0 deletions docs/public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/ /docs/react/
Binary file added docs/source/assets/client-diagrams/1-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/client-diagrams/2-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/client-diagrams/3-minimize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/devtools/devtools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/devtools/mutation-init.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/devtools/mutation-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/devtools/query-init-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/devtools/query-init.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/assets/devtools/query-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/source/basics/error-handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Error Handling
subtitle: Subtitle
description: Description
---

<h2 title="topic">Topic</h2>

<h3 title="subtopic">Sub Topic</h3>

```js
// code block
```

<h2 title="best-practices">Best Practices</h2>

<h2 title="API">API Documentation</h2>
Loading