composition-api icon indicating copy to clipboard operation
composition-api copied to clipboard

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

Open dimaaan21 opened this issue 3 years ago • 3 comments

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 avatar Jun 12 '22 01:06 dimaaan21

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

UPD: It doesn't work well (

dimaaan21 avatar Jun 12 '22 11:06 dimaaan21

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 :)

dimaaan21 avatar Jun 12 '22 13:06 dimaaan21

Stale issue message

github-actions[bot] avatar Aug 11 '22 23:08 github-actions[bot]