8000 Remove deprecated creation of store by Methuselah96 · Pull Request #946 · reduxjs/redux-devtools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove deprecated creation of store #946

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
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
30 changes: 3 additions & 27 deletions extension/src/browser/extension/inject/pageScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import {
Dispatch,
PreloadedState,
Reducer,
Store,
StoreEnhancer,
StoreEnhancerStoreCreator,
} from 'redux';
import Immutable from 'immutable';
import { EnhancedStore, PerformAction } from '@redux-devtools/instrument';
import createStore from '../../../app/stores/createStore';
import configureStore, { getUrlParam } from '../../../app/stores/enhancerStore';
import { isAllowed, Options } from '../options/syncOptions';
import Monitor from '../../../app/service/Monitor';
Expand Down Expand Up @@ -133,11 +131,6 @@ export interface Config extends ConfigWithExpandedMaxAge {
}

interface ReduxDevtoolsExtension {
<S, A extends Action<unknown>>(
reducer: Reducer<S, A>,
preloadedState?: PreloadedState<S>,
config?: Config
): Store<S, A>;
(config?: Config): StoreEnhancer;
open: (position?: Position) => void;
updateStore: (
Expand Down Expand Up @@ -167,21 +160,10 @@ declare global {
}

function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
reducer?: Reducer<S, A>,
preloadedState?: PreloadedState<S>,
config?: Config
): Store<S, A>;
function __REDUX_DEVTOOLS_EXTENSION__(config: Config): StoreEnhancer;
function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
reducer?: Reducer<S, A> | Config | undefined,
preloadedState?: PreloadedState<S>,
config?: Config
): Store<S, A> | StoreEnhancer {
): StoreEnhancer {
/* eslint-disable no-param-reassign */
if (typeof reducer === 'object') {
config = reducer;
reducer = undefined;
} else if (typeof config !== 'object') config = {};
if (typeof config !== 'object') config = {};
/* eslint-enable no-param-reassign */
if (!window.devToolsOptions) window.devToolsOptions = {} as any;

Expand Down Expand Up @@ -570,13 +552,7 @@ function __REDUX_DEVTOOLS_EXTENSION__<S, A extends Action<unknown>>(
};
};

if (!reducer) return enhance();
/* eslint-disable no-console */
console.warn(
'Creating a Redux store directly from DevTools extension is discouraged and will not be supported in future major version. For more details see: https://git.io/fphCe'
);
/* eslint-enable no-console */
return createStore(reducer, preloadedState, enhance);
return enhance();
}

declare global {
Expand Down
0