Skip to content

Commit 4b0e556

Browse files
feat(overmind-devtools): show effect arguments
1 parent 0c74225 commit 4b0e556

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createElement, FunctionComponent } from 'react'
1+
import { createElement, FunctionComponent, Fragment } from 'react'
22
import {
33
Operator as OperatorType,
44
EventType,
@@ -73,14 +73,18 @@ const ActionOperator: FunctionComponent<Props> = ({
7373
? effect.name + '.' + effect.method
7474
: effect.method}
7575
</span>
76-
{effect.args.length ? (
77-
<ValueInspector
78-
small
79-
value={
80-
effect.args.length > 1 ? effect.args : effect.args[0]
81-
}
82-
/>
83-
) : null}
76+
<span className={styles.effectArgs}>
77+
(
78+
{effect.args.map((arg, argIndex) => (
79+
<Fragment>
80+
<ValueInspector small value={arg} />
81+
{argIndex === effect.args.length - 1 ? null : (
82+
<span>,</span>
83+
)}
84+
</Fragment>
85+
))}
86+
)
87+
</span>
8488
{effect.result === undefined && !effect.error ? null : (
8589
<span
8690
className={css(
@@ -123,14 +127,9 @@ const ActionOperator: FunctionComponent<Props> = ({
123127
>
124128
{mutation.path}
125129
</span>
126-
<ValueInspector
127-
small
128-
value={
129-
mutation.args.length > 1
130-
? mutation.args
131-
: mutation.args[0]
132-
}
133-
/>
130+
{mutation.args.map((arg) => (
131+
<ValueInspector small value={arg} />
132+
))}
134133
</div>
135134
)
136135
}

packages/node_modules/overmind-devtools/src/components/ActionOperator/styles.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ export const operator = css({
88
cursor: 'default',
99
})
1010

11+
export const effectArgs = css({
12+
display: 'flex',
13+
alignItems: 'center',
14+
'> span': {
15+
marginRight: '0.5rem',
16+
},
17+
})
18+
1119
export const value = css({
1220
marginLeft: 'auto',
13-
paddingRight: '0.5rem',
1421
display: 'flex',
1522
alignItems: 'center',
1623
})

0 commit comments

Comments
 (0)