Skip to content

Commit b2a7a84

Browse files
committed
Revert "fix: set ssr appId in mounted hook"
This reverts commit 2dd1697.
1 parent 2dd1697 commit b2a7a84

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/shared/mixin.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ export default function createMixin(Vue, options) {
7575
this.$root._vueMeta.initialized = this.$isServer
7676

7777
if (!this.$root._vueMeta.initialized) {
78-
// we use the mounted hook here as on page load
79-
ensuredPush(this.$options, 'mounted', () => {
78+
ensuredPush(this.$options, 'beforeMount', () => {
8079
// if this Vue-app was server rendered, set the appId to 'ssr'
8180
// only one SSR app per page is supported
8281
if (this.$root.$el && this.$root.$el.hasAttribute('data-server-rendered')) {
8382
this.$root._vueMeta.appId = 'ssr'
8483
}
84+
})
8585

86+
// we use the mounted hook here as on page load
87+
ensuredPush(this.$options, 'mounted', () => {
8688
if (!this.$root._vueMeta.initialized) {
8789
// used in triggerUpdate to check if a change was triggered
8890
// during initialization

test/unit/components.test.js

+5-13
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,12 @@ describe('client', () => {
102102

103103
test('doesnt update when ssr attribute is set', () => {
104104
html.setAttribute(defaultOptions.ssrAttribute, 'true')
105-
const wrapper = mount(HelloWorld, {
106-
localVue: Vue,
107-
attrs: {
108-
'data-server-rendered': true
109-
}
110-
})
105+
const wrapper = mount(HelloWorld, { localVue: Vue })
111106

112107
const { tags } = wrapper.vm.$meta().refresh()
113-
expect(tags).toBe(false)
108+
// TODO: fix this test, not sure how to create a wrapper with a attri
109+
// bute data-server-rendered="true"
110+
expect(tags).not.toBe(false)
114111
})
115112

116113
test('changed function is called', async () => {
@@ -232,12 +229,7 @@ describe('client', () => {
232229
}
233230
})
234231

235-
const wrapper = mount(component, {
236-
localVue: Vue,
237-
attrs: {
238-
'data-server-rendered': true
239-
}
240-
})
232+
const wrapper = mount(component, { localVue: Vue })
241233
expect(html.getAttribute('theme')).not.toBe('dark')
242234

243235
await vmTick(wrapper.vm)

0 commit comments

Comments
 (0)