You’re right ![]()
Here’s the code I have a mistake with.
export default createWidget('discourse-custom-header', {
tagName: 'div',
html() {
return $.when($.ajax({
url: 'http://www.example.com/menu',
async: false
})).then(result => {
return [
h('div', [
new RawHtml({ html: `${result}` })
])
];
});
}
});
I get this warning
[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.
and this error
Error: Unexpected virtual child passed to h().
Expected a VNode / Vthunk / VWidget / string but:
got:
{}.
The parent vnode is:
{
"tagName": "DIV",
"properties": {
"attributes": {},
"className": "custom-menu"
}
}