vuejs / composition-api

Composition API plugin for Vue 2
https://composition-api.vuejs.org/
MIT License
4.19k stars 343 forks source link

"Failed to mount component: template or render function not defined." with render inside async setup #941

Closed dimaaan21 closed 2 years ago

dimaaan21 commented 2 years ago

OK-case

When i have sync setup - all is OK

import { h } from '@vue/composition-api';

export default {
  name: 'MyComponent',
  setup() {
    return () => h('div', [1234]);
  },
};

image

Error-case

But... with async - it throws an error

import { h } from '@vue/composition-api';

export default {
  name: 'MyComponent',
  async setup() {
    return () => h('div', [1234]);
  },
};

image

Since Vue 2 has no experimental Suspense i don't know what to do

dimaaan21 commented 2 years ago

I found Suspense for Vue 2 Should I use it or there is another solution?

UPD: It doesn't work well (

dimaaan21 commented 2 years ago

Found this trick image

Earlier i used the same but thought it's not a good workaround If there aren't any another solutions - issue can be closed :)

github-actions[bot] commented 2 years ago

Stale issue message