Skip to content

Commit

Permalink
Merge pull request #2747 from DivanteLtd/hotfix/v1.8.5
Browse files Browse the repository at this point in the history
Hotfix/v1.8.5
  • Loading branch information
pkarw committed Apr 17, 2019
2 parents 9159b45 + b90fb94 commit 1ebc92b
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.5] - 2019.04.17

### Fixed
- Memory leaks on SSR with Vue.use - @patzick (#2745)

## [1.8.4] - 2019.03.26

### Fixed
Expand Down
16 changes: 9 additions & 7 deletions core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import * as coreFilters from '@vue-storefront/core/filters'
import * as corePlugins from '@vue-storefront/core/compatibility/plugins'

import { once } from '@vue-storefront/core/helpers'
import { takeOverConsole } from '@vue-storefront/core/helpers/log'
import store from '@vue-storefront/core/store'

import { enabledModules } from './modules-entry'
Expand Down Expand Up @@ -58,7 +57,9 @@ function createRouter (): VueRouter {

let router: VueRouter = null

Vue.use(VueRouter)
once('__VUE_EXTEND_RR__', () => {
Vue.use(VueRouter)
})

const createApp = async (ssrContext, config): Promise<{app: Vue, router: VueRouter, store: Store<RootState>}> => {
router = createRouter()
Expand All @@ -75,13 +76,14 @@ const createApp = async (ssrContext, config): Promise<{app: Vue, router: VueRou
store.state.storeView = storeView
// store.state.shipping.methods = shippingMethods

Vue.use(Vuelidate)
Vue.use(VueLazyload, {attempt: 2, preLoad: 1.5})
Vue.use(Meta)
Vue.use(VueObserveVisibility)


// to depreciate in near future
once('__VUE_EXTEND__', () => {
Vue.use(Vuelidate)
Vue.use(VueLazyload, {attempt: 2, preLoad: 1.5})
Vue.use(Meta)
Vue.use(VueObserveVisibility)

Object.keys(corePlugins).forEach(key => {
Vue.use(corePlugins[key])
})
Expand Down
2 changes: 1 addition & 1 deletion core/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function once (key, fn) {
const { process = {} } = global
const processKey = key + '__ONCE__'
if (!process.hasOwnProperty(processKey)) {
Logger.debug(`Once ${key}`, 'helper')()
// Logger.debug(`Once ${key}`, 'helper')()
process[processKey] = true
fn()
}
Expand Down
5 changes: 4 additions & 1 deletion core/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import Vue from 'vue'
import VueI18n from 'vue-i18n'
import config from 'config'
import { Logger } from '@vue-storefront/core/lib/logger'
import { once } from '@vue-storefront/core/helpers'

Vue.use(VueI18n)
once('__VUE_EXTEND_I18N__', () => {
Vue.use(VueI18n)
})

const loadedLanguages = ['en-US']
const i18n = new VueI18n({
Expand Down
6 changes: 5 additions & 1 deletion core/scripts/resolvers/resolveGraphQL.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { server, graphql } from 'config'
import Vue from 'vue'
import { Logger } from '@vue-storefront/core/lib/logger'
import { once } from '@vue-storefront/core/helpers'

export const getApolloProvider = async () => {
if (server.api === 'graphql') {
const ApolloModule = await import(/* webpackChunkName: "vsf-graphql" */ 'vue-apollo')
const VueApollo = ApolloModule.default
Vue.use(VueApollo)

once('__VUE_EXTEND_GQL__', () => {
Vue.use(VueApollo)
})

const HttpLinkModule = await import(/* webpackChunkName: "vsf-graphql" */ 'apollo-link-http')
const HttpLink = HttpLinkModule.HttpLink
Expand Down
5 changes: 4 additions & 1 deletion core/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Vue from 'vue'
import Vuex from 'vuex'
import RootState from '@vue-storefront/core/types/RootState'
import { once } from '@vue-storefront/core/helpers'

Vue.use(Vuex)
once('__VUE_EXTEND_VUEX__', () => {
Vue.use(Vuex)
})

const state = {
version: '',
Expand Down
13 changes: 8 additions & 5 deletions src/modules/droppoint-shipping/components/DroppointMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@
<script>
import Vue from 'vue'
import { required, minLength } from 'vuelidate/lib/validators'
import { once } from '@vue-storefront/core/helpers'
// GoogleMaps cannot be included while in SSR
if (process.browser) {
const VueGoogleMaps = require('vue2-google-maps')
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyBQwWyTufRQqwJajpxqcCPfdgH27qKWNzc',
libraries: 'places'
}
once('__VUE_EXTEND_DROPPOINT__', () => {
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyBQwWyTufRQqwJajpxqcCPfdgH27qKWNzc',
libraries: 'places'
}
})
})
}
Expand Down
15 changes: 9 additions & 6 deletions src/modules/google-analytics/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import VueAnalytics from 'vue-analytics'
import { router } from '@vue-storefront/core/app'
import { Logger } from '@vue-storefront/core/lib/logger'
import { once } from '@vue-storefront/core/helpers'

export function beforeRegistration({ Vue, config, store, isServer }) {
if (config.analytics.id && !isServer) {
Vue.use(VueAnalytics, {
id: config.analytics.id,
router,
ecommerce: {
enabled: true
}
once('__VUE_EXTEND_ANALYTICS__', () => {
Vue.use(VueAnalytics, {
id: config.analytics.id,
router,
ecommerce: {
enabled: true
}
})
})
} else {
Logger.warn(
Expand Down
5 changes: 4 additions & 1 deletion src/themes/default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import routes from './router'
import Vue from 'vue'
import VueProgressBar from 'vue-progressbar'
import '@vue-storefront/core/lib/passive-listeners'
import { once } from '@vue-storefront/core/helpers'

Vue.use(VueProgressBar)
once('__VUE_EXTEND_DROPPOINT_VPB__', () => {
Vue.use(VueProgressBar)
})

const themeEntry = App
function initTheme (app, router, store, config, ssrContext) {
Expand Down

0 comments on commit 1ebc92b

Please sign in to comment.