Skip to content

Integrate the listener middleware into the RTK package #2072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
"packages": [
"packages/toolkit",
"packages/rtk-query-graphql-request-base-query",
"packages/action-listener-middleware",
"packages/rtk-query-codegen-openapi"
],
"publishDirectory": {
"@reduxjs/toolkit": "packages/toolkit",
"@rtk-query/graphql-request-base-query": "packages/rtk-query-graphql-request-base-query",
"@rtk-incubator/action-listener-middleware": "packages/action-listener-middleware",
"@rtk-query/codegen-openapi": "packages/rtk-query-codegen-openapi"
}
}
31 changes: 0 additions & 31 deletions .github/workflows/listenerTests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
fail-fast: false
matrix:
node: ['14.x']
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', 'next']
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6.1-rc', 'next']
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"test": "yarn test:packages",
"build:examples": "yarn workspaces foreach --include '@reduxjs/*' --include '@examples-query-react/*' --include '@examples-action-listener/*' -vtp run build",
"build:docs": "yarn workspace website run build",
"build:packages": "yarn workspaces foreach --include '@reduxjs/*' --include '@rtk-query/*' --include '@rtk-incubator/*' --topological-dev run build",
"build:packages": "yarn workspaces foreach --include '@reduxjs/*' --include '@rtk-query/*' --topological-dev run build",
"test:packages": "yarn workspaces foreach --include '@reduxjs/*' --include '@rtk-query/*' --include '@rtk-incubator/*' run test",
"dev:docs": "yarn workspace website run start"
}
Expand Down
4 changes: 0 additions & 4 deletions packages/action-listener-middleware/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions packages/action-listener-middleware/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion packages/action-listener-middleware/cjs.json

This file was deleted.

15 changes: 0 additions & 15 deletions packages/action-listener-middleware/jest.config.js

This file was deleted.

44 changes: 0 additions & 44 deletions packages/action-listener-middleware/package.json

This file was deleted.

35 changes: 0 additions & 35 deletions packages/action-listener-middleware/tsconfig.base.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/action-listener-middleware/tsconfig.json

This file was deleted.

17 changes: 0 additions & 17 deletions packages/action-listener-middleware/tsconfig.test.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/toolkit/src/createAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export type _ActionCreatorWithPreparedPayload<
*
* @inheritdoc {redux#ActionCreator}
*/
interface BaseActionCreator<P, T extends string, M = never, E = never> {
export interface BaseActionCreator<P, T extends string, M = never, E = never> {
type: T
match: (action: Action<unknown>) => action is PayloadAction<P, T, M, E>
}
Expand Down
12 changes: 8 additions & 4 deletions packages/toolkit/src/devtoolsExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,17 @@ export interface EnhancerOptions {
traceLimit?: number
}

type Compose = typeof compose

interface ComposeWithDevTools {
(options: EnhancerOptions): Compose
<StoreExt>(...funcs: StoreEnhancer<StoreExt>[]): StoreEnhancer<StoreExt>
}

/**
* @public
*/
export const composeWithDevTools: {
(options: EnhancerOptions): typeof compose
<StoreExt>(...funcs: Array<StoreEnhancer<StoreExt>>): StoreEnhancer<StoreExt>
} =
export const composeWithDevTools: ComposeWithDevTools =
typeof window !== 'undefined' &&
(window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
Expand Down
31 changes: 31 additions & 0 deletions packages/toolkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,34 @@ export type {
export { nanoid } from './nanoid'

export { default as isPlainObject } from './isPlainObject'

export type {
ListenerEffect,
ListenerMiddleware,
ListenerEffectAPI,
ListenerMiddlewareInstance,
CreateListenerMiddlewareOptions,
ListenerErrorHandler,
TypedStartListening,
TypedAddListener,
TypedStopListening,
TypedRemoveListener,
Unsubscribe,
ForkedTaskExecutor,
ForkedTask,
ForkedTaskAPI,
AsyncTaskExecutor,
SyncTaskExecutor,
TaskCancelled,
TaskRejected,
TaskResolved,
TaskResult,
} from './listenerMiddleware/index'

export {
createListenerMiddleware,
addListener,
removeListener,
removeAllListeners,
TaskAbortError,
} from './listenerMiddleware/index'
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import type {
Middleware,
Dispatch,
AnyAction,
Action,
ThunkDispatch,
MiddlewareAPI,
} from '@reduxjs/toolkit'
import { createAction, nanoid } from '@reduxjs/toolkit'
import type { Dispatch, AnyAction, MiddlewareAPI } from 'redux'
import type { ThunkDispatch } from 'redux-thunk'
import { createAction } from '../createAction'
import { nanoid } from '../nanoid'

import type {
ListenerMiddleware,
ListenerMiddlewareInstance,
AddListenerOverloads,
AnyListenerPredicate,
CreateListenerMiddlewareOptions,
TypedActionCreator,
TypedStartListening,
TypedAddListener,
TypedCreateListenerEntry,
FallbackAddListenerOptions,
Expand All @@ -27,7 +20,6 @@ import type {
ForkedTaskExecutor,
ForkedTask,
TypedRemoveListener,
TypedStopListening,
TaskResult,
} from './types'
import {
Expand Down
Loading