Skip to content
Myr

perf(devtools): avoid inferring action type when explicit action name is provided (#3147)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Vladimir Chirikov · committed by GitHub · parent a6143e0 · Browse files · 1 file+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:src/middleware/devtools.ts+6 added-2 removed
205 unmodified lines
206 let isRecording = true207 ;(api.setState as any) = ((state, replace, nameOrAction: Action) => {208 const r = set(state, replace as any)209 if (!isRecording) return r210 const inferredActionType = findCallerName(new Error().stack)210 const action: { type: string } =211 nameOrAction === undefined213 ? { type: anonymousActionType || inferredActionType || 'anonymous' }212 ? {213 type:214 anonymousActionType ||215 findCallerName(new Error().stack) ||216 'anonymous',217 }218 : typeof nameOrAction === 'string'219 ? { type: nameOrAction }220 : nameOrAction221 if (store === undefined) {
210 unmodified lines