anthonyshort / deku

Render interfaces using pure functions and virtual DOM
https://github.com/anthonyshort/deku/tree/master/docs
3.41k stars 130 forks source link

Cannot read property 'forEach' of undefined #433

Open uedaeita opened 3 years ago

uedaeita commented 3 years ago

I have encountered an error Cannot read property 'forEach' of undefined when I have deku.dom.create like the method as follows.

import * as deku from 'deku';

class someClass {
  public generateElement(): HTMLElement {
    let VNode = <div style='width: 100%; height: 100%;'></div>;
    return deku.dom.create(VNode);
  }
}

I found out vnode.children turned out to be undefined in below code in some cases (it does not always happen) for some reason, it would be great if anyone knows there is any way around? https://github.com/anthonyshort/deku/blob/master/src/dom/create.js#L73