forked from profectus/Profectus
Make nested player proxies of arrays as well as objects
This commit is contained in:
parent
f94c4a966f
commit
2d9de00424
1 changed files with 5 additions and 1 deletions
|
@ -51,7 +51,11 @@ const playerHandler: ProxyHandler<Record<PropertyKey, any>> = {
|
|||
}
|
||||
|
||||
const value = target[ProxyState][key];
|
||||
if (key !== "value" && isPlainObject(value) && !(value instanceof Decimal)) {
|
||||
if (
|
||||
key !== "value" &&
|
||||
(isPlainObject(value) || Array.isArray(value)) &&
|
||||
!(value instanceof Decimal)
|
||||
) {
|
||||
if (value !== target[key]?.[ProxyState]) {
|
||||
const path = [...target[ProxyPath], key];
|
||||
target[key] = new Proxy({ [ProxyState]: value, [ProxyPath]: path }, playerHandler);
|
||||
|
|
Loading…
Reference in a new issue