Replace generic anonymous labels with readable action names
Redux DevTools debugging
Zustand · Pipe
anonymousActionType is an optional devtools setting that names mutations lacking an explicit action type in Redux DevTools. It overrides the anonymous fallback when no inferred type is available.
anonymousActionType is a devtools option that supplies the action label for mutations without an explicit action type. If no label is configured, the middleware infers one when possible and otherwise uses anonymous.
devtools(stateCreatorFn, { anonymousActionType: string })| Name | Type | Description |
|---|---|---|
anonymousActionType | string | String used as the Redux DevTools action type for anonymous mutations; optional. |
Not applicable; this is an option within devtoolsOptions.
anonymous only when inference is unavailable.set with the replacement form, provide an action type as the third argument when you need a per-mutation label.anonymous.import { create } from 'zustand'
import { devtools } from 'zustand/middleware'
type Store = {
count: number
increment: () => void
}
const useStore = create<Store>()(
devtools(
(set) => ({
count: 0,
increment: () => set((state) => ({ count: state.count + 1 })),
}),
{ anonymousActionType: 'counter/increment' },
),
)
useStore.getState().increment()Sets the Redux DevTools label used for mutations whose action type is not otherwise supplied.
Redux DevTools debugging
Stores with direct set calls
Team debugging conventions
anonymousActionType control?It is an option on devtools(stateCreatorFn, devtoolsOptions) that names anonymous mutations in Redux DevTools. The default is an inferred action type, or anonymous when inference is unavailable.
Follow-up: How would you change the fallback label? Pass anonymousActionType in the middleware options, for example { anonymousActionType: 'counter/increment' }.
It applies when a mutation does not provide its own action type. The configured string becomes the action type shown by Redux DevTools instead of the default anonymous fallback.
Follow-up: What happens when the option is omitted? The middleware first uses an inferred action type when available, then falls back to anonymous.
anonymousActionType configured?The option is passed as part of the second argument to devtools, alongside the state creator. Its value is a string used for anonymous mutations.
Follow-up: What should be checked if every action still appears as anonymous? Verify that the option is supplied to the devtools middleware and that mutations are actually anonymous rather than using a different action-labeling path.
devtoolsdevtoolsOptionsRedux DevTools