Skip to content

Commit a9a2598

Browse files
committed
perf(devtools): avoid inferring action type when explicit action name is provided
1 parent 9d58820 commit a9a2598

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/middleware/devtools.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,14 @@ const devtoolsImpl: DevtoolsImpl =
207207
;(api.setState as any) = ((state, replace, nameOrAction: Action) => {
208208
const r = set(state, replace as any)
209209
if (!isRecording) return r
210-
const inferredActionType = findCallerName(new Error().stack)
211210
const action: { type: string } =
212211
nameOrAction === undefined
213-
? { type: anonymousActionType || inferredActionType || 'anonymous' }
212+
? {
213+
type:
214+
anonymousActionType ||
215+
findCallerName(new Error().stack) ||
216+
'anonymous',
217+
}
214218
: typeof nameOrAction === 'string'
215219
? { type: nameOrAction }
216220
: nameOrAction

0 commit comments

Comments
 (0)