-
Notifications
You must be signed in to change notification settings - Fork 407
Open
Description
Scenario
import { Component, mount, xml } from "@odoo/owl";
class Child extends Component {
static template = xml`<span t-esc="props.object.value" />`;
static props = {
object: {
type: Object,
shape: {
value: String,
},
},
};
}
// Main root component
class Root extends Component {
static components = { Child };
static template = xml`Hello <Child object="object" />`;
setup() {
this.object = Object.create(null);
this.object.value = "World";
}
}
mount(Root, document.body, { dev: true });Issue
Props validation fails, while the given object prop is indeed an object with the correct shape, although not having the "Object" prototype. While this object does not meet the "instanceof" check, I think it should still be validated as an object.
Cause
Object validation is made via <x> instanceof <Class>, which fails for objects without a prototype (i.e. Object.create(null)).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels