Skip to content

Commit eea7105

Browse files
feat(overmind): log out proxies as plain values
1 parent 582daf3 commit eea7105

File tree

1 file changed

+13
-1
lines changed
  • packages/node_modules/overmind/src

1 file changed

+13
-1
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { EventEmitter } from 'betsy'
22
import isPlainObject from 'is-plain-obj'
3-
import { IS_PROXY, ProxyStateTree, TTree, IMutation } from 'proxy-state-tree'
3+
import {
4+
IS_PROXY,
5+
ProxyStateTree,
6+
TTree,
7+
IMutation,
8+
VALUE,
9+
} from 'proxy-state-tree'
410
import { Derived } from './derived'
511
import { Devtools, Message, safeValue, safeValues } from './Devtools'
612
import {
@@ -106,6 +112,12 @@ export class Overmind<Config extends Configuration> implements Configuration {
106112
*/
107113

108114
if (!IS_PRODUCTION && typeof window !== 'undefined') {
115+
const originalConsoleLog = console.log
116+
console.log = (...args) =>
117+
originalConsoleLog.apply(
118+
console,
119+
args.map((arg) => (arg && arg[IS_PROXY] ? arg[VALUE] : arg))
120+
)
109121
if (
110122
options.devtools ||
111123
(location.hostname === 'localhost' && options.devtools !== false)

0 commit comments

Comments
 (0)