Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alimertcakar committed Feb 2, 2025
1 parent 85e14c3 commit a857aa6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/middleware/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export interface DevtoolsOptions extends Config {
name?: string
enabled?: boolean
anonymousActionType?: string
inferActionName?: boolean
store?: string
}

Expand Down Expand Up @@ -158,8 +157,7 @@ const extractConnectionInformation = (
const devtoolsImpl: DevtoolsImpl =
(fn, devtoolsOptions = {}) =>
(set, get, api) => {
const { enabled, anonymousActionType, inferActionName, store, ...options } =
devtoolsOptions
const { enabled, anonymousActionType, store, ...options } = devtoolsOptions

type S = ReturnType<typeof fn> & {
[store: string]: ReturnType<typeof fn>
Expand Down Expand Up @@ -188,10 +186,8 @@ const devtoolsImpl: DevtoolsImpl =
;(api.setState as any) = ((state, replace, nameOrAction: Action) => {
const r = set(state, replace as any)
if (!isRecording) return r
let defaultActionName = anonymousActionType
if (inferActionName) {
defaultActionName = findCallerName(new Error().stack ?? '')
}
const defaultActionName =
anonymousActionType ?? findCallerName(new Error().stack ?? '')
const action: { type: string } =
nameOrAction === undefined
? { type: defaultActionName || 'anonymous' }
Expand Down

0 comments on commit a857aa6

Please sign in to comment.