vuejs / composition-api

Composition API plugin for Vue 2

Home Page:https://composition-api.vuejs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

dimaaan21 opened this issue · 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

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

UPD: It doesn't work well (

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

Stale issue message