Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 1ebc92b

Browse files
authored
Merge pull request #2747 from DivanteLtd/hotfix/v1.8.5
Hotfix/v1.8.5
2 parents 9159b45 + b90fb94 commit 1ebc92b

File tree

9 files changed

+49
-23
lines changed

9 files changed

+49
-23
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.8.5] - 2019.04.17
8+
9+
### Fixed
10+
- Memory leaks on SSR with Vue.use - @patzick (#2745)
11+
712
## [1.8.4] - 2019.03.26
813

914
### Fixed

core/app.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import * as coreFilters from '@vue-storefront/core/filters'
2828
import * as corePlugins from '@vue-storefront/core/compatibility/plugins'
2929

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

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

5958
let router: VueRouter = null
6059

61-
Vue.use(VueRouter)
60+
once('__VUE_EXTEND_RR__', () => {
61+
Vue.use(VueRouter)
62+
})
6263

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

78-
Vue.use(Vuelidate)
79-
Vue.use(VueLazyload, {attempt: 2, preLoad: 1.5})
80-
Vue.use(Meta)
81-
Vue.use(VueObserveVisibility)
82-
79+
8380
// to depreciate in near future
8481
once('__VUE_EXTEND__', () => {
82+
Vue.use(Vuelidate)
83+
Vue.use(VueLazyload, {attempt: 2, preLoad: 1.5})
84+
Vue.use(Meta)
85+
Vue.use(VueObserveVisibility)
86+
8587
Object.keys(corePlugins).forEach(key => {
8688
Vue.use(corePlugins[key])
8789
})

core/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export function once (key, fn) {
153153
const { process = {} } = global
154154
const processKey = key + '__ONCE__'
155155
if (!process.hasOwnProperty(processKey)) {
156-
Logger.debug(`Once ${key}`, 'helper')()
156+
// Logger.debug(`Once ${key}`, 'helper')()
157157
process[processKey] = true
158158
fn()
159159
}

core/i18n/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import Vue from 'vue'
22
import VueI18n from 'vue-i18n'
33
import config from 'config'
44
import { Logger } from '@vue-storefront/core/lib/logger'
5+
import { once } from '@vue-storefront/core/helpers'
56

6-
Vue.use(VueI18n)
7+
once('__VUE_EXTEND_I18N__', () => {
8+
Vue.use(VueI18n)
9+
})
710

811
const loadedLanguages = ['en-US']
912
const i18n = new VueI18n({

core/scripts/resolvers/resolveGraphQL.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { server, graphql } from 'config'
22
import Vue from 'vue'
33
import { Logger } from '@vue-storefront/core/lib/logger'
4+
import { once } from '@vue-storefront/core/helpers'
45

56
export const getApolloProvider = async () => {
67
if (server.api === 'graphql') {
78
const ApolloModule = await import(/* webpackChunkName: "vsf-graphql" */ 'vue-apollo')
89
const VueApollo = ApolloModule.default
9-
Vue.use(VueApollo)
10+
11+
once('__VUE_EXTEND_GQL__', () => {
12+
Vue.use(VueApollo)
13+
})
1014

1115
const HttpLinkModule = await import(/* webpackChunkName: "vsf-graphql" */ 'apollo-link-http')
1216
const HttpLink = HttpLinkModule.HttpLink

core/store/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import Vue from 'vue'
22
import Vuex from 'vuex'
33
import RootState from '@vue-storefront/core/types/RootState'
4+
import { once } from '@vue-storefront/core/helpers'
45

5-
Vue.use(Vuex)
6+
once('__VUE_EXTEND_VUEX__', () => {
7+
Vue.use(Vuex)
8+
})
69

710
const state = {
811
version: '',

src/modules/droppoint-shipping/components/DroppointMap.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,18 @@
5555
<script>
5656
import Vue from 'vue'
5757
import { required, minLength } from 'vuelidate/lib/validators'
58+
import { once } from '@vue-storefront/core/helpers'
5859
5960
// GoogleMaps cannot be included while in SSR
6061
if (process.browser) {
6162
const VueGoogleMaps = require('vue2-google-maps')
62-
Vue.use(VueGoogleMaps, {
63-
load: {
64-
key: 'AIzaSyBQwWyTufRQqwJajpxqcCPfdgH27qKWNzc',
65-
libraries: 'places'
66-
}
63+
once('__VUE_EXTEND_DROPPOINT__', () => {
64+
Vue.use(VueGoogleMaps, {
65+
load: {
66+
key: 'AIzaSyBQwWyTufRQqwJajpxqcCPfdgH27qKWNzc',
67+
libraries: 'places'
68+
}
69+
})
6770
})
6871
}
6972

src/modules/google-analytics/hooks/beforeRegistration.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import VueAnalytics from 'vue-analytics'
22
import { router } from '@vue-storefront/core/app'
33
import { Logger } from '@vue-storefront/core/lib/logger'
4+
import { once } from '@vue-storefront/core/helpers'
45

56
export function beforeRegistration({ Vue, config, store, isServer }) {
67
if (config.analytics.id && !isServer) {
7-
Vue.use(VueAnalytics, {
8-
id: config.analytics.id,
9-
router,
10-
ecommerce: {
11-
enabled: true
12-
}
8+
once('__VUE_EXTEND_ANALYTICS__', () => {
9+
Vue.use(VueAnalytics, {
10+
id: config.analytics.id,
11+
router,
12+
ecommerce: {
13+
enabled: true
14+
}
15+
})
1316
})
1417
} else {
1518
Logger.warn(

src/themes/default/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import routes from './router'
44
import Vue from 'vue'
55
import VueProgressBar from 'vue-progressbar'
66
import '@vue-storefront/core/lib/passive-listeners'
7+
import { once } from '@vue-storefront/core/helpers'
78

8-
Vue.use(VueProgressBar)
9+
once('__VUE_EXTEND_DROPPOINT_VPB__', () => {
10+
Vue.use(VueProgressBar)
11+
})
912

1013
const themeEntry = App
1114
function initTheme (app, router, store, config, ssrContext) {

0 commit comments

Comments
 (0)