Skip to content

Commit 1288c5a

Browse files
fix(overmind): fixed listing internal actions
1 parent 9911e6d commit 1288c5a

File tree

1 file changed

+6
-12
lines changed
  • packages/node_modules/overmind/src

1 file changed

+6
-12
lines changed

packages/node_modules/overmind/src/utils.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,14 @@ export function mergeState(originState, oldState, nextState) {
8888
return merge(originState, oldState, nextState)
8989
}
9090

91-
export function getActionPaths(
92-
actions = {},
93-
currentPath: string[] = [],
94-
result: string[] = []
95-
) {
96-
return Object.keys(actions).reduce((aggr, key) => {
97-
if (isPlainObject(actions[key])) {
98-
return aggr.concat(
99-
getActionPaths(actions[key], currentPath.concat(key), result)
100-
)
91+
export function getActionPaths(actions = {}, currentPath: string[] = []) {
92+
return Object.keys(actions).reduce<string[]>((aggr, key) => {
93+
if (typeof actions[key] === 'function') {
94+
return aggr.concat(currentPath.concat(key).join('.'))
10195
}
10296

103-
return aggr.concat(currentPath.concat(key).join('.'))
104-
}, result)
97+
return aggr.concat(getActionPaths(actions[key], currentPath.concat(key)))
98+
}, [])
10599
}
106100

107101
export function createActionsProxy(actions, cb) {

0 commit comments

Comments
 (0)