Remove support for legacy context (#1575)

* Remove support for legacy context

* Create chatty-walls-burn.md
This commit is contained in:
Nathan Bierema 2023-12-17 20:48:45 -05:00 committed by GitHub
parent 6f9ef2e941
commit decc035570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 22 deletions

View File

@ -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.

View File

@ -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"
}
}

View File

@ -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>;
}
@ -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 = (
@ -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) {
@ -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');