JSideris / DOThtml

A human-friendly way to build highly-dynamic web pages in pure JavaScript.
2 stars 4 forks source link

Observable arrays don't render. #139

Closed JSideris closed 5 months ago

JSideris commented 1 year ago

The following code doesn't work:

import dot, { DotComponent, IDotElement } from "dothtml";

class MyComponent extends DotComponent{
    props = {
        myList: ["a", "b", "c"],
    }

    builder(...args: any[]): IDotElement {
        return dot.div(
            dot.h1("My List:")
            .div(
                ()=>this.props.myList
            )
        );
    }

    ready(): void {
        this.props.myList.push("1", "2", "3");
    }
}

dot(document.body).h(new MyComponent())

this.props.myList does get set to an observable array, but for some reason cannot be rendered.

JSideris commented 1 year ago

Note that dot.each() will render observable arrays correctly.

JSideris commented 5 months ago

Fixed in v6.