Skip to content

Commit 07e9e8e

Browse files
fix(overmind): pass flused mutations before component update
1 parent 4cd3bfb commit 07e9e8e

File tree

12 files changed

+95
-28
lines changed

12 files changed

+95
-28
lines changed

packages/node_modules/overmind-devtools/src/client/app/actions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export default (action: Action) => {
3434

3535
const openConsole = action().mutation(mutations.openConsole)
3636

37+
const openComponents = action().mutation(mutations.openComponents)
38+
3739
const openApp = action<string>()
3840

3941
const toggleExpandState = action<string[]>().mutation(
@@ -47,6 +49,7 @@ export default (action: Action) => {
4749
addPort,
4850
openState,
4951
openConsole,
52+
openComponents,
5053
openApp,
5154
toggleExpandState,
5255
}

packages/node_modules/overmind-devtools/src/client/app/mutations.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export const openState = (_, state: State) => (state.currentTab = Tab.State)
3838

3939
export const openConsole = (_, state: State) => (state.currentTab = Tab.Console)
4040

41+
export const openComponents = (_, state: State) =>
42+
(state.currentTab = Tab.Components)
43+
4144
export const toggleExpandStatePath = (path: string[], state: State) => {
4245
const pathString = path.join('.')
4346

@@ -47,7 +50,7 @@ export const toggleExpandStatePath = (path: string[], state: State) => {
4750
1
4851
)
4952
} else {
50-
state.expandedStatePaths.push(pathString)
53+
state.expandedStatePaths = state.expandedStatePaths.concat(pathString)
5154
}
5255
}
5356

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type Message = {
2222
export enum Tab {
2323
State = 'State',
2424
Console = 'Console',
25+
Components = 'Components',
2526
}
2627

2728
export type State = {

packages/node_modules/overmind-devtools/src/client/components/Components/elements.tsx

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import * as React from 'react'
2+
import { connect, Connect } from '../../app'
3+
4+
const Components: React.SFC<Connect> = () => <h1>Components</h1>
5+
6+
export default connect(Components)
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
import styled from '../../styled-components'
22

3-
export const Wrapper = styled.div``
3+
export const Wrapper = styled.div`
4+
overflow-y: scroll;
5+
height: 100%;
6+
`

packages/node_modules/overmind-devtools/src/client/components/Tabs/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const Tabs: React.SFC<Connect> = ({ appState, actions }) => (
1212
>
1313
<Icon>database</Icon>
1414
</Button>
15+
<Button
16+
active={appState.currentTab === Tab.Components}
17+
onClick={actions.openComponents}
18+
>
19+
<Icon>code</Icon>
20+
</Button>
1521
<Button
1622
active={appState.currentTab === Tab.Console}
1723
onClick={actions.openConsole}

packages/node_modules/overmind-devtools/src/client/components/Workspace/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import { Wrapper, Content, PageContainer } from './elements'
66
import Tabs from '../Tabs'
77
import Console from '../Console'
88
import State from '../State'
9+
import Components from '../Components'
910

1011
const pages: { [key in Tab]: React.ComponentType } = {
1112
[Tab.Console]: Console,
1213
[Tab.State]: State,
14+
[Tab.Components]: Components,
1315
}
1416

1517
const Workspace: React.SFC<Connect> = ({ appState }) => {

packages/node_modules/overmind-devtools/src/client/components/common/Icon/elements.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const icons = {
66
'plus-square': '\f0fe',
77
terminal: '\f120',
88
database: '\f1c0',
9+
code: '\f121',
910
}
1011

1112
export const IconElement = styled<
164 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)