summaryrefslogtreecommitdiff
path: root/doc/development/fe_guide
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-02-25 09:40:42 +0000
committerFilipa Lacerda <filipa@gitlab.com>2019-02-25 09:40:42 +0000
commit4f5bb0886e2cbaf009de26559197f66323537e88 (patch)
tree53a35b059e6a48517c6731002b7f07bc79187e1d /doc/development/fe_guide
parent1c30b12b868ffc3d73589d42a811bc47f8f631c9 (diff)
parent6ed496a89604286ed2158ff3c15f29b3baa0e721 (diff)
downloadgitlab-ce-4f5bb0886e2cbaf009de26559197f66323537e88.tar.gz
Merge branch 'design-management-vue-app-ce' into 'master'
Port design-management-vue-app to CE See merge request gitlab-org/gitlab-ce!25494
Diffstat (limited to 'doc/development/fe_guide')
-rw-r--r--doc/development/fe_guide/graphql.md28
1 files changed, 26 insertions, 2 deletions
diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md
index 4e9caa65b3f..3290f29530a 100644
--- a/doc/development/fe_guide/graphql.md
+++ b/doc/development/fe_guide/graphql.md
@@ -27,11 +27,11 @@ the Vue application is mounted.
```javascript
import Vue from 'vue';
import VueApollo from 'vue-apollo';
-import defaultClient from '~/lib/graphql';
+import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
- defaultClient,
+ defaultClient: createDefaultClient(),
});
new Vue({
@@ -43,6 +43,29 @@ new Vue({
Read more about [Vue Apollo][vue-apollo] in the [Vue Apollo documentation][vue-apollo-docs].
+### Local state with `apollo-link-state`
+
+It is possible to use our Apollo setup with [apollo-link-state][apollo-link-state] by passing
+in the client state object when creating the default client.
+
+```javascript
+import Vue from 'vue';
+import VueApollo from 'vue-apollo';
+import createDefaultClient from '~/lib/graphql';
+Vue.use(VueApollo);
+
+const apolloProvider = new VueApollo({
+ defaultClient: createDefaultClient({
+ defaults: {
+ testing: true,
+ },
+ resolvers: {
+ ...
+ },
+ }),
+});
+```
+
### Testing
With [Vue test utils][vue-test-utils] it is easy to quickly test components that
@@ -81,3 +104,4 @@ Read more about the [Apollo] client in the [Apollo documentation][apollo-client-
[default-client]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/lib/graphql.js
[apollo-client-docs]: https://www.apollographql.com/docs/tutorial/client.html
[vue-test-utils]: https://vue-test-utils.vuejs.org/
+[apollo-link-state]: https://www.apollographql.com/docs/link/links/state.html