Skip to content

Fix: 500 error using Vue+Meteor SSR after update vue-meta version to 2.3.4 #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/shared/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ export default function createMixin (Vue, options) {
$root.$once('hook:beforeMount', function () {
wasServerRendered = this.$el && this.$el.nodeType === 1 && this.$el.hasAttribute('data-server-rendered')

// In most cases when you have a SSR app it will be the first app thats gonna be
// initiated, if we cant detect the data-server-rendered attribute from Vue but we
// do see our own ssrAttribute then _assume_ the Vue app with appId 1 is the ssr app
// attempted fix for #404 & #562, but we rly need to refactor how we pass appIds from
// ssr to the client
if (!wasServerRendered && $root[rootConfigKey] && $root[rootConfigKey].appId === 1) {
// The Vue Meteor SSR doesn't have `$this.el()` in this stage
// Fixes the 500 error with `document is not defined` message
if (typeof document !== 'undefined' &&
// In most cases when you have a SSR app it will be the first app thats gonna be
// initiated, if we cant detect the data-server-rendered attribute from Vue but we
// do see our own ssrAttribute then _assume_ the Vue app with appId 1 is the ssr app
// attempted fix for #404 & #562, but we rly need to refactor how we pass appIds from
// ssr to the client
!wasServerRendered && $root[rootConfigKey] && $root[rootConfigKey].appId === 1) {
const htmlTag = getTag({}, 'html')
wasServerRendered = htmlTag && htmlTag.hasAttribute(options.ssrAttribute)
}
Expand Down