From decc0355703b3f9f0bb38fb640a10adb5d247fd9 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 17 Dec 2023 20:48:45 -0500 Subject: [PATCH] Remove support for legacy context (#1575) * Remove support for legacy context * Create chatty-walls-burn.md --- .changeset/chatty-walls-burn.md | 5 ++++ packages/redux-devtools/package.json | 4 +-- .../redux-devtools/src/createDevTools.tsx | 26 +++++-------------- 3 files changed, 13 insertions(+), 22 deletions(-) create mode 100644 .changeset/chatty-walls-burn.md diff --git a/.changeset/chatty-walls-burn.md b/.changeset/chatty-walls-burn.md new file mode 100644 index 00000000..4b050ce7 --- /dev/null +++ b/.changeset/chatty-walls-burn.md @@ -0,0 +1,5 @@ +--- +'@redux-devtools/core': major +--- + +Remove support for legacy context. Minimum supported react-redux version is 7.0.0 and minimum support React version is 16.8.4. diff --git a/packages/redux-devtools/package.json b/packages/redux-devtools/package.json index 05eb2b69..bc1c6507 100644 --- a/packages/redux-devtools/package.json +++ b/packages/redux-devtools/package.json @@ -74,8 +74,8 @@ "typescript": "~5.3.3" }, "peerDependencies": { - "react": "^0.14.9 || ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", - "react-redux": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", + "react": "^16.8.4 || ^17.0.0 || ^18.0.0", + "react-redux": "^7.0.0 || ^8.0.0 || ^9.0.0", "redux": "^3.5.2 || ^4.0.0 || ^5.0.0" } } diff --git a/packages/redux-devtools/src/createDevTools.tsx b/packages/redux-devtools/src/createDevTools.tsx index 967bf829..ef9f288f 100644 --- a/packages/redux-devtools/src/createDevTools.tsx +++ b/packages/redux-devtools/src/createDevTools.tsx @@ -25,12 +25,7 @@ function logError(type: string) { } } -export interface Props< - S, - A extends Action, - MonitorState, - MonitorAction extends Action, -> { +export interface Props, MonitorState> { store?: EnhancedStore; } @@ -65,9 +60,7 @@ export default function createDevTools< (state: LiftedState) => state, )(Monitor as React.ComponentType); - return class DevTools extends Component< - Props - > { + return class DevTools extends Component> { liftedStore?: LiftedStore; static instrument = ( @@ -78,11 +71,8 @@ export default function createDevTools< options, ); - constructor( - props: Props, - context?: { store?: EnhancedStore }, - ) { - super(props, context); + constructor(props: Props) { + super(props); if (ReactReduxContext) { if (this.props.store && !this.props.store.liftedStore) { @@ -91,16 +81,12 @@ export default function createDevTools< return; } - if (!props.store && !context?.store) { + if (!props.store) { logError('NoStore'); return; } - if (context?.store) { - this.liftedStore = context.store.liftedStore; - } else { - this.liftedStore = props.store!.liftedStore; - } + this.liftedStore = props.store.liftedStore; if (!this.liftedStore) { logError('NoLiftedStore');