This minor release:
- Adds a second parameter to
entityAdapter.getInitialState(additionalProps, entities)
to allow prefilling state- Equivalent to
entityAdapter.setAll(entityAdapter.getInitialState(additionalProps), entities)
- First parameter can be
undefined
if no additional properties are desired
- Equivalent to
- Allows initialising
combineSlices
with no static reducers- Previously
const combinedReducer = combineSlices().withLazyLoadedSlices<LazyLoadedSlices>()
would have thrown an error - Now returns a "no-op" reducer that just returns an empty object until first reducer injected
- Previously
- Allows a new
'throw'
value foroverrideExisting
ininjectEndpoints
, which throws an error if a definition is injected with a name which is already used - Exports more type helpers for RTKQ hook and trigger types
- Exports types related to overriding result types in
enhanceEndpoints
- Fixes state inference for injected slices when undeclared (i.e. not in
LazyLoadedSlices
) - Adds a
action.meta.arg.isPrefetch
value to query thunk actions when prefetched
What's Changed
- Revamp type tests setup by @aryaemami59 in #4095
- Bump Prettier and Prettier related packages by @aryaemami59 in #4126
- Fix codemods to work with TypeScript 4.7+ by @aryaemami59 in #4081
- Export types related to overriding the result types by @aryaemami59 in #4134
- Migrate type tests to Vitest by @aryaemami59 in #4127
- Fix RetryOptions type test by flipping order by @EskiMojo14 in #4136
- Format all files by @aryaemami59 in #4135
- [Docs/Website] skipPollingIfUnfocused added to polling overview and query options by @riqts in #4131
- [Docs] Changed create.asyncThunk setup admonition to caution by @riqts in #4150
- Temporarily revert node-fetch bump until ESM issues are sorted by @EskiMojo14 in #4151
- Contributing Markdown Refresh by @itz-Me-Pj in #4139
- investigate re-adding size limit action by @EskiMojo14 in #4083
- Add size limit imports for more commonly used RTK exports by @EskiMojo14 in #4155
- pure some things by @EskiMojo14 in #4157
- cut back on suffixes tested for size by @EskiMojo14 in #4160
- Incorrect builder method referenced by @kantbtrue in #4161
- Rename
cli.js
tocli.mjs
by @aryaemami59 in #4169 - Migrate Codegen OpenAPI's unit tests to Vitest by @aryaemami59 in #4137
- Fix wrong state for injected slices when not declared via
withLazyLoadedSlices
by @aryaemami59 in #4172 - [Docs, createEntityAdapter API]: add missing setOne and setMany signature by @kyselberg in #4173
- Corrected the "Observing cache behaviour" example point no.4 by @721-atikshaikh in #4174
- feat: add isPrefetch property in query action by @juliengbt in #4177
- allow initialising combined slice reducer with no static slices by @EskiMojo14 in #4184
- Create more Typed wrappers for RTKQ hook types by @EskiMojo14 in #4147
- proposal fix for axios base query types by @smff in #4186
- Provide 'throw' option for
overrideExisting
by @ffluk3 in #4189 - Use vite-tsconfig-paths to make path aliasing easier by @aryaemami59 in #4175
- Remove trailing commas in
tsconfig.json
files of all CodesandBox examples by @aryaemami59 in #4190 - [Docs] Added withTypes documentation in createDraftSafeSelector by @riqts in #4143
- Add second parameter to getInitialState to prefill entities by @EskiMojo14 in #4183
New Contributors
- @itz-Me-Pj made their first contribution in #4139
- @kantbtrue made their first contribution in #4161
- @kyselberg made their first contribution in #4173
- @721-atikshaikh made their first contribution in #4174
- @smff made their first contribution in #4186
- @ffluk3 made their first contribution in #4189
Full Changelog: v2.1.0...v2.2.0