Skip to content

Commit a0bb156

Browse files
fix(overmind-devtools): show action selector when no actions
1 parent b01acaa commit a0bb156

File tree

3 files changed

+14
-22
lines changed
  • packages
    • node_modules/overmind-devtools/src/components
    • overmind-website/examples/guide/routing

3 files changed

+14
-22
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ const ActionSelector: FunctionComponent = () => {
1919
}}
2020
/>
2121

22-
<form
23-
className={styles.inputWrapper}
24-
onSubmit={(event) => {
25-
event.preventDefault()
26-
actions.submitQueryAction()
27-
}}
28-
>
22+
<div className={styles.inputWrapper}>
2923
<div className={styles.suggestion}>{app.actionQuerySuggestion}</div>
3024
<input
3125
autoFocus
@@ -37,7 +31,7 @@ const ActionSelector: FunctionComponent = () => {
3731
actions.changeActionQuery(event.currentTarget.value)
3832
}
3933
/>
40-
</form>
34+
</div>
4135
<div className={styles.resultWrapper}>
4236
{app.actionPaths
4337
.filter((path) => path.startsWith(app.actionQuery))

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,19 @@ import ActionsTools from 'overmind-devtools/src/components/ActionsTools'
99
const Actions: FunctionComponent = () => {
1010
const { state } = useOvermind()
1111

12-
if (!state.currentAction) {
13-
return (
14-
<div className={styles.centerWrapper}>
15-
<span className={textStyles.header}>no actions triggered...</span>
16-
</div>
17-
)
18-
}
19-
2012
return (
2113
<div className={styles.wrapper}>
2214
<ActionsTools />
23-
<div className={styles.columns}>
24-
<ActionsList />
25-
<Action />
26-
</div>
15+
{state.currentAction ? (
16+
<div className={styles.columns}>
17+
<ActionsList />
18+
<Action />
19+
</div>
20+
) : (
21+
<div className={styles.centerWrapper}>
22+
<span className={textStyles.header}>no actions triggered...</span>
23+
</div>
24+
)}
2725
</div>
2826
)
2927
}

packages/overmind-website/examples/guide/routing/setup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const showHomePage: Action = ({ state }) => {
1111
}
1212
1313
export const showUsersPage: Action = async ({ state, effects }) => {
14-
state.user = null
14+
state.modalUser = null
1515
state.currentPage = 'users'
1616
state.isLoadingUsers = true
1717
state.users = await effects.api.getUsers()
@@ -35,7 +35,7 @@ export const showHomePage = ({ state }) => {
3535
}
3636
3737
export const showUsersPage = async ({ state, api }) => {
38-
state.user = null
38+
state.modalUser = null
3939
state.currentPage = 'users'
4040
state.isLoadingUsers = true
4141
state.users = await api.getUsers()

0 commit comments

Comments
 (0)