mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] props validation: do not subscribe to props keys
In dev mode, owl inserts an additional props validation step. Before this commit, the validation would iterate on all key/value pairs of each props. If the props is reactive, this has the unfortunate side effect of subscribing the component to each of the keys, even though it should not be. This commit avoids the issue by only validating the raw object.
This commit is contained in:
committed by
Sam Degueldre
parent
fed9cc467f
commit
8f2c7f24d7
@@ -1,4 +1,5 @@
|
||||
import { OwlError } from "./error_handling";
|
||||
import { toRaw } from "./reactivity";
|
||||
|
||||
type BaseType =
|
||||
| typeof String
|
||||
@@ -84,6 +85,7 @@ export function validateSchema(obj: { [key: string]: any }, schema: Schema): str
|
||||
if (Array.isArray(schema)) {
|
||||
schema = toSchema(schema);
|
||||
}
|
||||
obj = toRaw(obj);
|
||||
let errors = [];
|
||||
// check if each value in obj has correct shape
|
||||
for (let key in obj) {
|
||||
|
||||
Reference in New Issue
Block a user