Vue-apollo: [SSR] Rendering of Components with inline string template crashes

Created on 9 Dec 2019  路  9Comments  路  Source: vuejs/vue-apollo

Describe the bug
After upgrading from 3.0.0 to 3.0.2 i found that the rendering of our dynamic components is broken. It looks like it was caused by a change in 3.0.1 (https://github.com/vuejs/vue-apollo/issues/852).
If a component doesn't have an explicit render function, it will brake when executing render.call (mixin.js line 156).
This bug was also mentioned by @drewbaker here: https://github.com/vuejs/vue-apollo/commit/e6cbaa2af45b80478884e0d518fb6b93743737b5

To Reproduce
Create a view with a dynamic component

<template>
  <TemplateLiteralComponent/>
</template>

<script>
export default {
  name: 'BugReport',
  components: {
    TemplateLiteralComponent,
  },
  apollo: {
    something: {
       query: someQuery.gql,
    }
  },
}
</script>

And use a component that doesn't have a render function

<script>
export default {
  name: 'TemplateLiteralComponent',
  template: '<h3>TemplateLiteralComponent</h3>',
}
</script>

Expected behavior
This should render Test inside a div.cms-content.

Versions
vue: 2.6.10
vue-apollo: 3.0.2

bug

Most helpful comment

Will look at it today.

All 9 comments

Your computed property is weird, it registers a global component (which is a side-effect that computed properties should not do), and doesn't return anything, so it will always evaluate to false

If that's the code you actually use, I don't see how it could have ever worked, and I don't see how this is related to vue-apollo.

Assuming your example is incorrect/incomplete, please correct it.

Thanks for pointing out the side-effect. I'll work on that.

I've changed the example above to only use a single static component with a template string.

This component throws that error for me: https://github.com/funkhaus/haus-components/blob/master/WpContent.vue

Downgrading works.

FYI that component Is special in that it allows a string of HTML from WordPress to be passed in, and that string can have Vue components in it and those will be rendered. It requires the compiler version of Vue.

My services are broken after upgrading @nuxtjs/apollo (which upgraded vue-apollo from v3.0.0 to v3.0.1):

TypeError
Cannot read property 'call' of undefined

Screenshot 2019-12-10 at 16 00 21

The pages that are broken are using v-runtime-template/vue-template-compile which might be related.

Same error here on nuxt, broken after update 3.0.0 > 3.0.1 here is sandbox

https://codesandbox.io/s/wp-content-urj01?fontsize=14&hidenavigation=1&theme=dark

problem is same with render function, that is located components/WpTest.vue

This is a serious regression, probably not only for Nuxt users.

@Akryum I think this needs some attention, do you have a bit of time to check this out?

Seems to be pretty straighforward to fix but I don't feel confident in this codebase to send a PR

Will look at it today.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anymost picture anymost  路  3Comments

jakub300 picture jakub300  路  4Comments

beeplin picture beeplin  路  4Comments

agosto-chrisbartling picture agosto-chrisbartling  路  4Comments

dsbert picture dsbert  路  4Comments