Skip to content

Commit 725f782

Browse files
fix(proxy-state-tree): add proxies to returned derived values
1 parent 2a9c683 commit 725f782

File tree

1 file changed

+8
-4
lines changed
  • packages/node_modules/proxy-state-tree/src

1 file changed

+8
-4
lines changed

packages/node_modules/proxy-state-tree/src/proxify.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,18 @@ function createObjectProxy(tree, value, path) {
120120
if (typeof prop === 'symbol' || prop in Object.prototype)
121121
return target[prop]
122122

123-
const targetValue = target[prop]
123+
let targetValue = target[prop]
124124
const nestedPath = concat(path, prop)
125125
trackPath(tree, nestedPath)
126126

127127
if (typeof targetValue === 'function') {
128-
return tree.options.dynamicWrapper
129-
? tree.options.dynamicWrapper(tree, nestedPath, targetValue)
130-
: targetValue(tree, nestedPath)
128+
return proxify(
129+
tree,
130+
tree.options.dynamicWrapper
131+
? tree.options.dynamicWrapper(tree, nestedPath, targetValue)
132+
: targetValue(tree, nestedPath),
133+
nestedPath
134+
)
131135
}
132136

133137
if (targetValue === undefined) {

0 commit comments

Comments
 (0)