Skip to content

t-out with arrays is funky #1920

Description

@ged-odoo

This code show a situation with a t-out defined with a array

import { Component, mount, xml, signal, proxy, onMounted } from "@odoo/owl";

class Root extends Component {
    static template = xml`<t t-out="this.value().join('.')"/>`;

    value = signal.Array([1,2]);

    setup() {
        onMounted(() => {
            this.value().unshift(0);
        });
    }
}

mount(Root, document.body, { templates: TEMPLATES, dev: true });

It only works because we have a .join('.') on the t-out, making it a string. otherwise, without it, the output does not display the 0. This is likely to be caused by the fact that owl compares the reference of the array in the t-out, which did not change, so it does not update the content. not sure it is something that we should change, just putting the example here for discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions