diff --git a/package-lock.json b/package-lock.json index faba96ea..7ddac34c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9716,8 +9716,7 @@ "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" }, "is-plain-object": { "version": "2.0.4", diff --git a/package.json b/package.json index 75075162..87357cf9 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "electron-json-storage": "4.1.0", "express": "4.16.3", "install": "0.12.1", - "is-plain-object": "2.0.4", + "is-plain-obj": "1.1.0", "marksy": "6.1.0", "npm": "6.3.0", "page": "1.8.6", diff --git a/packages/node_modules/overmind-devtools/src/app/state.ts b/packages/node_modules/overmind-devtools/src/app/state.ts index e35277c1..c0a1dd92 100644 --- a/packages/node_modules/overmind-devtools/src/app/state.ts +++ b/packages/node_modules/overmind-devtools/src/app/state.ts @@ -42,7 +42,7 @@ const state: State = { newPortValue: '', currentTab: Tab.State, expandedStatePaths: [''], - expandAllActionDetails: false, + expandAllActionDetails: true, expandedComponents: [], currentApp: (state) => state.apps[state.currentAppName], componentsMounted: (state) => diff --git a/packages/node_modules/overmind-devtools/src/components/ActionOperator/index.tsx b/packages/node_modules/overmind-devtools/src/components/ActionOperator/index.tsx index f696c45f..f0edbc20 100644 --- a/packages/node_modules/overmind-devtools/src/components/ActionOperator/index.tsx +++ b/packages/node_modules/overmind-devtools/src/components/ActionOperator/index.tsx @@ -25,7 +25,6 @@ const ActionOperator: SFC = ({ const { state, actions } = useOvermind() const isExpanded = state.expandAllActionDetails || !operator.isCollapsed - console.log(operator.mutations) return (
{value === undefined ? null : ( diff --git a/packages/node_modules/overmind/package.json b/packages/node_modules/overmind/package.json index a4891e49..f2c71dcd 100644 --- a/packages/node_modules/overmind/package.json +++ b/packages/node_modules/overmind/package.json @@ -33,7 +33,7 @@ ], "dependencies": { "@types/node": "^10.5.1", - "is-plain-object": "^2.0.4", + "is-plain-obj": "^1.1.0", "betsy": "next", "proxy-state-tree": "next", "tslib": "^1.9.3" diff --git a/packages/node_modules/overmind/src/Devtools.ts b/packages/node_modules/overmind/src/Devtools.ts index fdba9f6d..3bc7aabb 100644 --- a/packages/node_modules/overmind/src/Devtools.ts +++ b/packages/node_modules/overmind/src/Devtools.ts @@ -1,6 +1,5 @@ import { IS_PROXY } from 'proxy-state-tree' -// Needed due to Parcel + Webpack support -const isPlainObject = require('is-plain-object') +import * as isPlainObject from 'is-plain-obj' export type Message = { type: string @@ -22,7 +21,7 @@ export function safeValue(value) { aggr[key] = safeValue(value[key]) return aggr - }, value) + }, {}) : value } diff --git a/packages/node_modules/overmind/src/index.ts b/packages/node_modules/overmind/src/index.ts index 7378b52d..45681d55 100644 --- a/packages/node_modules/overmind/src/index.ts +++ b/packages/node_modules/overmind/src/index.ts @@ -1,7 +1,8 @@ import { EventEmitter } from 'betsy' -import { IS_PROXY, ProxyStateTree, TTree } from 'proxy-state-tree' +import * as isPlainObject from 'is-plain-obj' +import { IS_PROXY, ProxyStateTree, TTree, IMutation } from 'proxy-state-tree' import { Derived } from './derived' -import { Devtools, Message, safeValue } from './Devtools' +import { Devtools, Message, safeValue, safeValues } from './Devtools' import { Events, EventType, @@ -41,13 +42,16 @@ export type Derive = TDerive< export type OnInitialize = TOnInitialize -const isPlainObject = require('is-plain-object') const IS_PRODUCTION = process.env.NODE_ENV === 'production' const IS_DEVELOPMENT = process.env.NODE_ENV === 'development' const IS_OPERATOR = Symbol('operator') -export const log = (...objects: any[]) => - console.log(...objects.map((obj) => JSON.parse(JSON.stringify(obj)))) +export const makeStringifySafeMutations = (mutations: IMutation[]) => { + return mutations.map((mutation) => ({ + ...mutation, + args: safeValues(mutation.args), + })) +} const hotReloadingCache = {} @@ -123,6 +127,7 @@ export class Overmind implements Configuration { data: { ...data, ...flushData, + mutations: makeStringifySafeMutations(flushData.mutations), }, }) } @@ -135,6 +140,7 @@ export class Overmind implements Configuration { data: { ...data, ...flushData, + mutations: makeStringifySafeMutations(flushData.mutations), }, }) } @@ -247,7 +253,7 @@ export class Overmind implements Configuration { mutationTree.onMutation((mutation) => { this.eventHub.emit(EventType.MUTATIONS, { ...execution, - mutations: [mutation], + mutations: makeStringifySafeMutations([mutation]), }) setTimeout(() => { const flushData = this.proxyStateTree.flush(true) @@ -257,6 +263,7 @@ export class Overmind implements Configuration { data: { ...execution, ...flushData, + mutations: makeStringifySafeMutations(flushData.mutations), }, }) } @@ -749,7 +756,7 @@ export function mutate( context.execution.emit(EventType.MUTATIONS, { ...context.execution, operatorId: context.execution.operatorId + 1, - mutations: [mutation], + mutations: makeStringifySafeMutations([mutation]), }) }) } diff --git a/packages/node_modules/proxy-state-tree/src/index.ts b/packages/node_modules/proxy-state-tree/src/index.ts index d376abff..7c5603dc 100644 --- a/packages/node_modules/proxy-state-tree/src/index.ts +++ b/packages/node_modules/proxy-state-tree/src/index.ts @@ -1,4 +1,5 @@ import { IS_PROXY, VALUE, PATH, Proxifier } from './Proxyfier' +import * as isPlainObject from 'is-plain-obj' import { IMutation, ITrackMutationTree, @@ -13,7 +14,6 @@ import { } from './types' import { TrackMutationTree } from './TrackMutationTree' import { TrackStateTree } from './TrackStateTree' -const isPlainObject = require('is-plain-object') const IS_PRODUCTION = process.env.NODE_ENV === 'production' export { diff --git a/packages/overmind-website/src/app/onInitialize.ts b/packages/overmind-website/src/app/onInitialize.ts index d1fbd824..68cb4dcf 100644 --- a/packages/overmind-website/src/app/onInitialize.ts +++ b/packages/overmind-website/src/app/onInitialize.ts @@ -8,7 +8,7 @@ const onInitialize: OnInitialize = ({ css, }) => { state.typescript = storage.get('typescript') || false - state.theme = storage.get('theme') || 'components' + state.theme = storage.get('theme') || 'react' css.changePrimary(state.theme) router.route('/', app.actions.openHome) diff --git a/packages/overmind-website/src/app/state.ts b/packages/overmind-website/src/app/state.ts index 4a0d574d..74aec97b 100644 --- a/packages/overmind-website/src/app/state.ts +++ b/packages/overmind-website/src/app/state.ts @@ -7,7 +7,6 @@ import { Demo, SearchResult, } from './types' -import { Derive } from 'overmind' type State = { page: Page @@ -25,7 +24,6 @@ type State = { isLoadingSearchResult: boolean searchResult: SearchResult[] showSearchResult: boolean - test: string } const state: State = { @@ -44,7 +42,6 @@ const state: State = { isLoadingSearchResult: false, searchResult: [], showSearchResult: false, - test: '', } export default state