|
|
@ -644,8 +644,19 @@ const objectHandlers = { |
|
|
|
if (shouldProxy(val)) { |
|
|
|
if (shouldProxy(val)) { |
|
|
|
if (!objToProxy.has(val)) { |
|
|
|
if (!objToProxy.has(val)) { |
|
|
|
// Link newly wrapped child to its parent for path reconstruction.
|
|
|
|
// Link newly wrapped child to its parent for path reconstruction.
|
|
|
|
const parentMeta = proxyMeta.get(receiver)!; |
|
|
|
// In some edge cases parent metadata might not yet be initialized (e.g.,
|
|
|
|
const childProxy = createProxy(val, objectHandlers, parentMeta.root); |
|
|
|
// if a proxied structure was reconstructed in a way that bypassed the
|
|
|
|
|
|
|
|
// original deepSignal root path). Fall back to creating/assigning it.
|
|
|
|
|
|
|
|
let parentMeta = proxyMeta.get(receiver); |
|
|
|
|
|
|
|
if (!parentMeta) { |
|
|
|
|
|
|
|
// Assign a root id (new symbol) so downstream patches remain groupable.
|
|
|
|
|
|
|
|
const created: ProxyMeta = { |
|
|
|
|
|
|
|
root: Symbol("deepSignalRootAuto"), |
|
|
|
|
|
|
|
} as ProxyMeta; |
|
|
|
|
|
|
|
proxyMeta.set(receiver, created); |
|
|
|
|
|
|
|
parentMeta = created; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const childProxy = createProxy(val, objectHandlers, parentMeta!.root); |
|
|
|
const childMeta = proxyMeta.get(childProxy)!; |
|
|
|
const childMeta = proxyMeta.get(childProxy)!; |
|
|
|
childMeta.parent = receiver; |
|
|
|
childMeta.parent = receiver; |
|
|
|
childMeta.key = fullKey; |
|
|
|
childMeta.key = fullKey; |
|
|
|