Skip to content

Commit ca48e27

Browse files
Merge pull request cerebral#171 from cerebral/fixes6
Fixes6
2 parents c96e3de + 4c933e4 commit ca48e27

File tree

10 files changed

+22
-21
lines changed

10 files changed

+22
-21
lines changed

package-lock.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"electron-json-storage": "4.1.0",
3232
"express": "4.16.3",
3333
"install": "0.12.1",
34-
"is-plain-object": "2.0.4",
34+
"is-plain-obj": "1.1.0",
3535
"marksy": "6.1.0",
3636
"npm": "6.3.0",
3737
"page": "1.8.6",

packages/node_modules/overmind-devtools/src/app/state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const state: State = {
4242
newPortValue: '',
4343
currentTab: Tab.State,
4444
expandedStatePaths: [''],
45-
expandAllActionDetails: false,
45+
expandAllActionDetails: true,
4646
expandedComponents: [],
4747
currentApp: (state) => state.apps[state.currentAppName],
4848
componentsMounted: (state) =>

packages/node_modules/overmind-devtools/src/components/ActionOperator/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const ActionOperator: SFC<Props> = ({
2525
const { state, actions } = useOvermind()
2626
const isExpanded = state.expandAllActionDetails || !operator.isCollapsed
2727

28-
console.log(operator.mutations)
2928
return (
3029
<div>
3130
{value === undefined ? null : (

packages/node_modules/overmind/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
],
3434
"dependencies": {
3535
"@types/node": "^10.5.1",
36-
"is-plain-object": "^2.0.4",
36+
"is-plain-obj": "^1.1.0",
3737
"betsy": "next",
3838
"proxy-state-tree": "next",
3939
"tslib": "^1.9.3"

packages/node_modules/overmind/src/Devtools.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { IS_PROXY } from 'proxy-state-tree'
2-
// Needed due to Parcel + Webpack support
3-
const isPlainObject = require('is-plain-object')
2+
import * as isPlainObject from 'is-plain-obj'
43

54
export type Message = {
65
type: string
@@ -22,7 +21,7 @@ export function safeValue(value) {
2221
aggr[key] = safeValue(value[key])
2322

2423
return aggr
25-
}, value)
24+
}, {})
2625
: value
2726
}
2827

packages/node_modules/overmind/src/index.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { EventEmitter } from 'betsy'
2-
import { IS_PROXY, ProxyStateTree, TTree } from 'proxy-state-tree'
2+
import * as isPlainObject from 'is-plain-obj'
3+
import { IS_PROXY, ProxyStateTree, TTree, IMutation } from 'proxy-state-tree'
34
import { Derived } from './derived'
4-
import { Devtools, Message, safeValue } from './Devtools'
5+
import { Devtools, Message, safeValue, safeValues } from './Devtools'
56
import {
67
Events,
78
EventType,
@@ -41,13 +42,16 @@ export type Derive<Parent extends TStateObject, Value> = TDerive<
4142

4243
export type OnInitialize = TOnInitialize<TheConfig>
4344

44-
const isPlainObject = require('is-plain-object')
4545
const IS_PRODUCTION = process.env.NODE_ENV === 'production'
4646
const IS_DEVELOPMENT = process.env.NODE_ENV === 'development'
4747
const IS_OPERATOR = Symbol('operator')
4848

49-
export const log = (...objects: any[]) =>
50-
console.log(...objects.map((obj) => JSON.parse(JSON.stringify(obj))))
49+
export const makeStringifySafeMutations = (mutations: IMutation[]) => {
50+
return mutations.map((mutation) => ({
51+
...mutation,
52+
args: safeValues(mutation.args),
53+
}))
54+
}
5155

5256
const hotReloadingCache = {}
5357

@@ -123,6 +127,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
123127
data: {
124128
...data,
125129
...flushData,
130+
mutations: makeStringifySafeMutations(flushData.mutations),
126131
},
127132
})
128133
}
@@ -135,6 +140,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
135140
data: {
136141
...data,
137142
...flushData,
143+
mutations: makeStringifySafeMutations(flushData.mutations),
138144
},
139145
})
140146
}
@@ -247,7 +253,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
247253
mutationTree.onMutation((mutation) => {
248254
this.eventHub.emit(EventType.MUTATIONS, {
249255
...execution,
250-
mutations: [mutation],
256+
mutations: makeStringifySafeMutations([mutation]),
251257
})
252258
setTimeout(() => {
253259
const flushData = this.proxyStateTree.flush(true)
@@ -257,6 +263,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
257263
data: {
258264
...execution,
259265
...flushData,
266+
mutations: makeStringifySafeMutations(flushData.mutations),
260267
},
261268
})
262269
}
@@ -749,7 +756,7 @@ export function mutate<Input, Config extends Configuration = TheConfig>(
749756
context.execution.emit(EventType.MUTATIONS, {
750757
...context.execution,
751758
operatorId: context.execution.operatorId + 1,
752-
mutations: [mutation],
759+
mutations: makeStringifySafeMutations([mutation]),
753760
})
754761
})
755762
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { IS_PROXY, VALUE, PATH, Proxifier } from './Proxyfier'
2+
import * as isPlainObject from 'is-plain-obj'
23
import {
34
IMutation,
45
ITrackMutationTree,
@@ -13,7 +14,6 @@ import {
1314
} from './types'
1415
import { TrackMutationTree } from './TrackMutationTree'
1516
import { TrackStateTree } from './TrackStateTree'
16-
const isPlainObject = require('is-plain-object')
1717
const IS_PRODUCTION = process.env.NODE_ENV === 'production'
1818

1919
export {

packages/overmind-website/src/app/onInitialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const onInitialize: OnInitialize = ({
88
css,
99
}) => {
1010
state.typescript = storage.get('typescript') || false
11-
state.theme = storage.get('theme') || 'components'
11+
state.theme = storage.get('theme') || 'react'
1212
css.changePrimary(state.theme)
1313

1414
router.route('/', app.actions.openHome)

packages/overmind-website/src/app/state.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
Demo,
88
SearchResult,
99
} from './types'
10-
import { Derive } from 'overmind'
1110

1211
type State = {
1312
page: Page
@@ -25,7 +24,6 @@ type State = {
2524
isLoadingSearchResult: boolean
2625
searchResult: SearchResult[]
2726
showSearchResult: boolean
28-
test: string
2927
}
3028

3129
const state: State = {
@@ -44,7 +42,6 @@ const state: State = {
4442
isLoadingSearchResult: false,
4543
searchResult: [],
4644
showSearchResult: false,
47-
test: '',
4845
}
4946

5047
export default state

0 commit comments

Comments
 (0)