Skip to content

Commit

Permalink
Remove support for legacy context (#1575)
Browse files Browse the repository at this point in the history
* Remove support for legacy context

* Create chatty-walls-burn.md
  • Loading branch information
Methuselah96 committed Dec 18, 2023
1 parent 6f9ef2e commit decc035
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-walls-burn.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions packages/redux-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
26 changes: 6 additions & 20 deletions packages/redux-devtools/src/createDevTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ function logError(type: string) {
}
}

export interface Props<
S,
A extends Action<string>,
MonitorState,
MonitorAction extends Action<string>,
> {
export interface Props<S, A extends Action<string>, MonitorState> {
store?: EnhancedStore<S, A, MonitorState>;
}

Expand Down Expand Up @@ -65,9 +60,7 @@ export default function createDevTools<
(state: LiftedState<S, A, MonitorState>) => state,
)(Monitor as React.ComponentType<any>);

return class DevTools extends Component<
Props<S, A, MonitorState, MonitorAction>
> {
return class DevTools extends Component<Props<S, A, MonitorState>> {
liftedStore?: LiftedStore<S, A, MonitorState>;

static instrument = (
Expand All @@ -78,11 +71,8 @@ export default function createDevTools<
options,
);

constructor(
props: Props<S, A, MonitorState, MonitorAction>,
context?: { store?: EnhancedStore<S, A, MonitorState> },
) {
super(props, context);
constructor(props: Props<S, A, MonitorState>) {
super(props);

if (ReactReduxContext) {
if (this.props.store && !this.props.store.liftedStore) {
Expand All @@ -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');
Expand Down

0 comments on commit decc035

Please sign in to comment.