[FIX] props validation: make it work through slots

A recent commit fixes the props validation code to make it work
regardless of the rendering context (important with the recent
t-call-context directive). Unfortunately, it then breaks props
validation through slots, because it assumed that the parent node in the
virtual node was the parent of the component, but it is not necessarily
true.

To fix this, we can use a simple property of the template functions:
they are bound to the current instance of the component, so we can
simply use "this"
This commit is contained in:
Géry Debongnie
2022-09-26 15:02:43 +02:00
committed by Sam Degueldre
parent ab29b896eb
commit 17fb33475c
9 changed files with 140 additions and 80 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ export class App<
mount(target: HTMLElement, options?: MountOptions): Promise<Component<P, E> & InstanceType<T>> {
App.validateTarget(target);
if (this.dev) {
validateProps(this.Root, this.props, { app: this });
validateProps(this.Root, this.props, { __owl__: { app: this } });
}
const node = this.makeNode(this.Root, this.props);
const prom = this.mountNode(node, target, options);