From 2ef69009db30b3e5355deb1ff75c07a5f2fc2aef Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 9 Apr 2018 20:12:38 +0200 Subject: [PATCH] fix(ui): mergeData crash --- packages/@vue/cli-service/package.json | 2 +- packages/@vue/cli-ui-addon-build/package.json | 4 ++-- packages/@vue/cli-ui/package.json | 4 ++-- packages/@vue/cli-ui/src/main.js | 10 +++++----- .../src/util/{PluginAction.js => plugin-action.js} | 6 +++--- .../cli-ui/src/util/{SharedData.js => shared-data.js} | 3 +++ yarn.lock | 10 +++++++--- 7 files changed, 23 insertions(+), 16 deletions(-) rename packages/@vue/cli-ui/src/util/{PluginAction.js => plugin-action.js} (87%) rename packages/@vue/cli-ui/src/util/{SharedData.js => shared-data.js} (99%) diff --git a/packages/@vue/cli-service/package.json b/packages/@vue/cli-service/package.json index 720891e562..379c3f222d 100644 --- a/packages/@vue/cli-service/package.json +++ b/packages/@vue/cli-service/package.json @@ -62,7 +62,7 @@ "uglifyjs-webpack-plugin": "^1.2.2", "url-loader": "^1.0.1", "vue-loader": "^14.2.1", - "vue-template-compiler": "^2.5.13", + "vue-template-compiler": "^2.5.17-beta.0", "webpack": "^3.10.0", "webpack-chain": "^4.5.0", "webpack-dev-server": "^2.11.1", diff --git a/packages/@vue/cli-ui-addon-build/package.json b/packages/@vue/cli-ui-addon-build/package.json index abb162f82a..4ff84bcc48 100644 --- a/packages/@vue/cli-ui-addon-build/package.json +++ b/packages/@vue/cli-ui-addon-build/package.json @@ -18,10 +18,10 @@ "@vue/eslint-config-standard": "^3.0.0-beta.3", "stylus": "^0.54.5", "stylus-loader": "^3.0.1", - "vue-template-compiler": "^2.5.13" + "vue-template-compiler": "^2.5.17-beta.0" }, "peerDependencies": { - "vue": "^2.5.13" + "vue": "^2.5.17-beta.0" }, "browserslist": [ "> 1%", diff --git a/packages/@vue/cli-ui/package.json b/packages/@vue/cli-ui/package.json index efd81baa97..b167084756 100644 --- a/packages/@vue/cli-ui/package.json +++ b/packages/@vue/cli-ui/package.json @@ -34,7 +34,7 @@ "shortid": "^2.2.8", "subscriptions-transport-ws": "^0.9.5", "terminate": "^2.1.0", - "vue": "^2.5.13", + "vue": "^2.5.17-beta.0", "vue-apollo": "^3.0.0-beta.5", "vue-i18n": "^7.6.0", "vue-instantsearch": "^1.5.1", @@ -52,7 +52,7 @@ "stylus": "^0.54.5", "stylus-loader": "^3.0.1", "vue-cli-plugin-apollo": "^0.7.1", - "vue-template-compiler": "^2.5.13" + "vue-template-compiler": "^2.5.17-beta.0" }, "browserslist": [ "> 1%", diff --git a/packages/@vue/cli-ui/src/main.js b/packages/@vue/cli-ui/src/main.js index 385e5242c6..2f9d3e83db 100644 --- a/packages/@vue/cli-ui/src/main.js +++ b/packages/@vue/cli-ui/src/main.js @@ -9,13 +9,14 @@ import * as Filters from './filters' import './register-components' import ClientAddonApi from './util/ClientAddonApi' import Responsive from './util/responsive' -import SharedData from './util/SharedData' -import PluginAction from './util/PluginAction' +import SharedData from './util/shared-data' +import PluginAction from './util/plugin-action' import gql from 'graphql-tag' window.gql = gql -Vue.use(VueUi) +Vue.use(SharedData) +Vue.use(PluginAction) Vue.use(InstantSearch) Vue.use(Responsive, { computed: { @@ -30,8 +31,7 @@ Vue.use(Responsive, { } } }) -Vue.use(SharedData) -Vue.use(PluginAction) +Vue.use(VueUi) for (const key in Filters) { Vue.filter(key, Filters[key]) diff --git a/packages/@vue/cli-ui/src/util/PluginAction.js b/packages/@vue/cli-ui/src/util/plugin-action.js similarity index 87% rename from packages/@vue/cli-ui/src/util/PluginAction.js rename to packages/@vue/cli-ui/src/util/plugin-action.js index ae08880783..efcc7ed3f1 100644 --- a/packages/@vue/cli-ui/src/util/PluginAction.js +++ b/packages/@vue/cli-ui/src/util/plugin-action.js @@ -8,7 +8,7 @@ export default { install (Vue) { Vue.mixin({ methods: { - $callAction (id, params) { + $callPluginAction (id, params) { return this.$apollo.mutate({ mutation: PLUGIN_ACTION_CALL, variables: { @@ -17,13 +17,13 @@ export default { } }) }, - $onActionCalled (cb) { + $onPluginActionCalled (cb) { return this.$apollo.addSmartSubscription(`plugin-action-called-${uid++}`, { query: PLUGIN_ACTION_CALLED, result: cb }) }, - $onActionResolved (cb) { + $onPluginActionResolved (cb) { return this.$apollo.addSmartSubscription(`plugin-action-resolved-${uid++}`, { query: PLUGIN_ACTION_RESOLVED, result: cb diff --git a/packages/@vue/cli-ui/src/util/SharedData.js b/packages/@vue/cli-ui/src/util/shared-data.js similarity index 99% rename from packages/@vue/cli-ui/src/util/SharedData.js rename to packages/@vue/cli-ui/src/util/shared-data.js index 12b95699d9..0875118470 100644 --- a/packages/@vue/cli-ui/src/util/SharedData.js +++ b/packages/@vue/cli-ui/src/util/shared-data.js @@ -62,6 +62,7 @@ export default { }) return result.sharedData.value }, + $watchSharedData (id, cb) { return this.$apollo.addSmartQuery(id, { ...genQuery(id), @@ -71,6 +72,7 @@ export default { } }) }, + $setSharedData (id, value) { return this.$apollo.mutate({ mutation: SHARED_DATA_UPDATE, @@ -80,6 +82,7 @@ export default { } }) }, + $syncSharedData (options) { const smartQueries = [] for (const key in options) { diff --git a/yarn.lock b/yarn.lock index e2092cc557..bc3ef2094e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10813,9 +10813,9 @@ vue-style-loader@^4.0.1: hash-sum "^1.0.2" loader-utils "^1.0.2" -vue-template-compiler@^2.5.13: - version "2.5.13" - resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.13.tgz#12a2aa0ecd6158ac5e5f14d294b0993f399c3d38" +vue-template-compiler@^2.5.17-beta.0: + version "2.5.17-beta.0" + resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.17-beta.0.tgz#6653d4029bd6fc427de616ce626e7f1db63e615c" dependencies: de-indent "^1.0.2" he "^1.1.0" @@ -10828,6 +10828,10 @@ vue@^2.5.13: version "2.5.13" resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.13.tgz#95bd31e20efcf7a7f39239c9aa6787ce8cf578e1" +vue@^2.5.17-beta.0: + version "2.5.17-beta.0" + resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.17-beta.0.tgz#b9985447818827306beee146923a1bd64f1bb834" + vuex@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.0.1.tgz#e761352ebe0af537d4bb755a9b9dc4be3df7efd2"