Skip to content

Commit 27f7c16

Browse files
Merge pull request cerebral#94 from cerebral/stringifyNestedSafely
fix(overmind): stringify nested values safely
2 parents fd3022a + 33637d0 commit 27f7c16

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/node_modules/overmind/src/Devtools.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ export function safeValue(value) {
1616
return `[${value.constructor.name || 'NOT SERIALIZABLE'}]`
1717
}
1818

19-
return value
19+
return isPlainObject(value)
20+
? Object.keys(value).reduce((aggr, key) => {
21+
aggr[key] = safeValue(value[key])
22+
23+
return aggr
24+
}, value)
25+
: value
2026
}
2127

2228
export function safeValues(values) {

0 commit comments

Comments
 (0)