CodeVetter · Repo Unpack · Extension points
reduxjs/redux-toolkit
Customization is organized around factories, endpoint definitions, middleware registration, and reducer injection. RTK Query modules augment a shared API during initialization and endpoint injection. Application-specific lifecycle callbacks and transport implementations sit above the core machinery. Companion tools expose configuration and AST-transform boundaries for extending generated or migrated code.
- buildCreateApi accepts modules implementing init; each initialized module receives injectEndpoint calls. reactHooksModule supports custom React Redux hooks, batching, selector creation, and optional side effects during render.
- injectEndpoints adds query/mutation/infiniteQuery definitions and controls duplicate replacement through overrideExisting; enhanceEndpoints adds tag types or mutates/merges existing endpoint definitions.
- Endpoints can supply queryFn instead of query/baseQuery translation, with access to API context and a baseQuery callback. fetchBaseQuery separately permits custom fetchFn, prepareHeaders, serializers, status validation, and response handlers.
- onQueryStarted receives requestId, getCacheEntry, queryFulfilled, and query-only updateCachedData; middleware resolves or rejects its lifecycle promise from terminal thunk actions.
- combineSlices.inject updates its reducer map and recomposes reducers, refusing conflicting replacements unless overrideExisting is set; slice.injectInto delegates to that injectable interface and returns adjusted selector properties.
- createDynamicMiddleware registers middleware by function identity and caches composition by version; createListenerMiddleware offers startListening/stopListening, while buildCreateSlice can opt into asyncThunkCreator.
- OpenAPI generation supports multiple outputs with shared/per-output options, endpoint and parameter matchers, operationId transformers, query/mutation overrides, explicit tags, hook selection, and alternative enum representations.
- Codemods plug in as transforms/<argv-name>/index.ts; createSliceBuilder exports a tsx parser and Transform. Documentation navigation is another explicit registry: new pages must be listed in docs/sidebars.ts.