Skip to content

Commit 59f8fa5

Browse files
authored
Merge pull request #3398 from reduxjs/feature/2.0-remove-deprecations
2 parents 17ed591 + b0c96b2 commit 59f8fa5

18 files changed

+108
-230
lines changed

docs/api/immutabilityMiddleware.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ interface ImmutableStateInvariantMiddlewareOptions {
3636
ignoredPaths?: (string | RegExp)[]
3737
/** Print a warning if checks take longer than N ms. Default: 32ms */
3838
warnAfter?: number
39-
// @deprecated. Use ignoredPaths
40-
ignore?: string[]
4139
}
4240
```
4341

packages/toolkit/src/createSlice.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ import type { Id, NoInfer, Tail } from './tsHelpers'
1919
import { freezeDraftable } from './utils'
2020
import type { CombinedSliceReducer, InjectConfig } from './combineSlices'
2121

22-
let hasWarnedAboutObjectNotation = false
23-
24-
/**
25-
* An action creator attached to a slice.
26-
*
27-
* @deprecated please use PayloadActionCreator directly
28-
*
29-
* @public
30-
*/
31-
export type SliceActionCreator<P> = PayloadActionCreator<P>
32-
3322
/**
3423
* The return value of `createSlice`
3524
*

packages/toolkit/src/devtoolsExtension.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ export interface DevToolsEnhancerOptions {
9090
* function which takes `state` object and index as arguments, and should return `state` object back.
9191
*/
9292
stateSanitizer?: <S>(state: S, index: number) => S
93-
/**
94-
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
95-
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
96-
* @deprecated Use actionsDenylist instead.
97-
*/
98-
actionsBlacklist?: string | string[]
99-
/**
100-
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
101-
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
102-
* @deprecated Use actionsAllowlist instead.
103-
*/
104-
actionsWhitelist?: string | string[]
10593
/**
10694
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
10795
* If `actionsAllowlist` specified, `actionsDenylist` is ignored.

packages/toolkit/src/immutableStateInvariantMiddleware.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ export interface ImmutableStateInvariantMiddlewareOptions {
167167
ignoredPaths?: IgnorePaths
168168
/** Print a warning if checks take longer than N ms. Default: 32ms */
169169
warnAfter?: number
170-
// @deprecated. Use ignoredPaths
171-
ignore?: string[]
172170
}
173171

174172
/**
@@ -226,12 +224,8 @@ export function createImmutableStateInvariantMiddleware(
226224
isImmutable = isImmutableDefault,
227225
ignoredPaths,
228226
warnAfter = 32,
229-
ignore,
230227
} = options
231228

232-
// Alias ignore->ignoredPaths, but prefer ignoredPaths if present
233-
ignoredPaths = ignoredPaths || ignore
234-
235229
const track = trackForMutations.bind(null, isImmutable, ignoredPaths)
236230

237231
return ({ getState }) => {

packages/toolkit/src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export type {
6969
SliceCaseReducers,
7070
ValidateSliceCaseReducers,
7171
CaseReducerWithPrepare,
72-
SliceActionCreator,
7372
} from './createSlice'
7473
export {
7574
// js
@@ -90,10 +89,6 @@ export type {
9089
// types
9190
SerializableStateInvariantMiddlewareOptions,
9291
} from './serializableStateInvariantMiddleware'
93-
export {
94-
// js
95-
getDefaultMiddleware,
96-
} from './getDefaultMiddleware'
9792
export type {
9893
// types
9994
ActionReducerMapBuilder,

packages/toolkit/src/query/core/buildInitiate.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ export type MutationActionCreatorResult<
181181
The value returned by the hook will reset to `isUninitialized` afterwards.
182182
*/
183183
reset(): void
184-
/** @deprecated has been renamed to `reset` */
185-
unsubscribe(): void
186184
}
187185

188186
export function buildInitiate({
@@ -219,37 +217,6 @@ export function buildInitiate({
219217
getRunningMutationThunk,
220218
getRunningQueriesThunk,
221219
getRunningMutationsThunk,
222-
getRunningOperationPromises,
223-
removalWarning,
224-
}
225-
226-
/** @deprecated to be removed in 2.0 */
227-
function removalWarning(): never {
228-
throw new Error(
229-
`This method had to be removed due to a conceptual bug in RTK.
230-
Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details.
231-
See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`
232-
)
233-
}
234-
235-
/** @deprecated to be removed in 2.0 */
236-
function getRunningOperationPromises() {
237-
if (
238-
typeof process !== 'undefined' &&
239-
process.env.NODE_ENV === 'development'
240-
) {
241-
removalWarning()
242-
} else {
243-
const extract = <T>(
244-
v: Map<Dispatch<AnyAction>, Record<string, T | undefined>>
245-
) =>
246-
Array.from(v.values()).flatMap((queriesForStore) =>
247-
queriesForStore ? Object.values(queriesForStore) : []
248-
)
249-
return [...extract(runningQueries), ...extract(runningMutations)].filter(
250-
isNotNullish
251-
)
252-
}
253220
}
254221

255222
function getRunningQueryThunk(endpointName: string, queryArgs: any) {
@@ -464,7 +431,6 @@ You must add the middleware for RTK-Query to function correctly!`
464431
requestId,
465432
abort,
466433
unwrap,
467-
unsubscribe: reset,
468434
reset,
469435
})
470436

packages/toolkit/src/query/core/buildSelectors.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ export type SkipToken = typeof skipToken
4545
* return an uninitialized state.
4646
*/
4747
export const skipToken = /* @__PURE__ */ Symbol.for('RTKQ/skipToken')
48-
/** @deprecated renamed to `skipToken` */
49-
export const skipSelector = skipToken
5048

5149
declare module './module' {
5250
export interface ApiEndpointQuery<

packages/toolkit/src/query/core/buildSlice.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,6 @@ export function buildSlice({
494494
...subscriptionSlice.actions,
495495
...internalSubscriptionsSlice.actions,
496496
...mutationSlice.actions,
497-
/** @deprecated has been renamed to `removeMutationResult` */
498-
unsubscribeMutationResult: mutationSlice.actions.removeMutationResult,
499497
resetApiState,
500498
}
501499

packages/toolkit/src/query/core/module.ts

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ export type CoreModule =
7171
| ReferenceQueryLifecycle
7272
| ReferenceCacheCollection
7373

74-
export interface ThunkWithReturnValue<T> extends ThunkAction<T, any, any, AnyAction> {}
74+
export interface ThunkWithReturnValue<T>
75+
extends ThunkAction<T, any, any, AnyAction> {}
7576

7677
declare module '../apiTypes' {
7778
export interface ApiModules<
@@ -139,28 +140,6 @@ declare module '../apiTypes' {
139140
* A collection of utility thunks for various situations.
140141
*/
141142
util: {
142-
/**
143-
* This method had to be removed due to a conceptual bug in RTK.
144-
*
145-
* Despite TypeScript errors, it will continue working in the "buggy" way it did
146-
* before in production builds and will be removed in the next major release.
147-
*
148-
* Nonetheless, you should immediately replace it with the new recommended approach.
149-
* See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.
150-
*
151-
* Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details.
152-
* @deprecated
153-
*/
154-
getRunningOperationPromises: never // this is now types as `never` to immediately throw TS errors on use, but still allow for a comment
155-
156-
/**
157-
* This method had to be removed due to a conceptual bug in RTK.
158-
* It has been replaced by `api.util.getRunningQueryThunk` and `api.util.getRunningMutationThunk`.
159-
* Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details.
160-
* @deprecated
161-
*/
162-
getRunningOperationPromise: never // this is now types as `never` to immediately throw TS errors on use, but still allow for a comment
163-
164143
/**
165144
* A thunk that (if dispatched) will return a specific running query, identified
166145
* by `endpointName` and `args`.
@@ -268,11 +247,7 @@ declare module '../apiTypes' {
268247
Definitions,
269248
RootState<Definitions, string, ReducerPath>
270249
>
271-
/** @deprecated renamed to `updateQueryData` */
272-
updateQueryResult: UpdateQueryDataThunk<
273-
Definitions,
274-
RootState<Definitions, string, ReducerPath>
275-
>
250+
276251
/**
277252
* A Redux thunk action creator that, when dispatched, acts as an artificial API request to upsert a value into the cache.
278253
*
@@ -326,11 +301,7 @@ declare module '../apiTypes' {
326301
Definitions,
327302
RootState<Definitions, string, ReducerPath>
328303
>
329-
/** @deprecated renamed to `patchQueryData` */
330-
patchQueryResult: PatchQueryDataThunk<
331-
Definitions,
332-
RootState<Definitions, string, ReducerPath>
333-
>
304+
334305
/**
335306
* A Redux action creator that can be dispatched to manually reset the api state completely. This will immediately remove all existing cache entries, and all queries will be considered 'uninitialized'.
336307
*
@@ -571,8 +542,6 @@ export const coreModule = (): Module<CoreModule> => ({
571542
getRunningMutationsThunk,
572543
getRunningQueriesThunk,
573544
getRunningQueryThunk,
574-
getRunningOperationPromises,
575-
removalWarning,
576545
} = buildInitiate({
577546
queryThunk,
578547
mutationThunk,
@@ -582,8 +551,6 @@ export const coreModule = (): Module<CoreModule> => ({
582551
})
583552

584553
safeAssign(api.util, {
585-
getRunningOperationPromises: getRunningOperationPromises as any,
586-
getRunningOperationPromise: removalWarning as any,
587554
getRunningMutationThunk,
588555
getRunningMutationsThunk,
589556
getRunningQueryThunk,

packages/toolkit/src/query/endpointDefinitions.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,6 @@ export type ResultDescription<
230230
| ReadonlyArray<TagDescription<TagTypes>>
231231
| GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>
232232

233-
/** @deprecated please use `onQueryStarted` instead */
234-
export interface QueryApi<ReducerPath extends string, Context extends {}> {
235-
/** @deprecated please use `onQueryStarted` instead */
236-
dispatch: ThunkDispatch<any, any, AnyAction>
237-
/** @deprecated please use `onQueryStarted` instead */
238-
getState(): RootState<any, any, ReducerPath>
239-
/** @deprecated please use `onQueryStarted` instead */
240-
extra: unknown
241-
/** @deprecated please use `onQueryStarted` instead */
242-
requestId: string
243-
/** @deprecated please use `onQueryStarted` instead */
244-
context: Context
245-
}
246-
247233
export interface QueryTypes<
248234
QueryArg,
249235
BaseQuery extends BaseQueryFn,

0 commit comments

Comments
 (0)