Skip to content

Commit

Permalink
Update redux, ,react-redux and corresponding types (elastic#22442)
Browse files Browse the repository at this point in the history
  • Loading branch information
weltenwort committed Aug 29, 2018
1 parent b705fed commit 44113be
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 41 deletions.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@
"react-grid-layout": "^0.16.2",
"react-input-range": "^1.3.0",
"react-markdown": "^3.1.4",
"react-redux": "^5.0.6",
"react-redux": "^5.0.7",
"react-router-dom": "4.2.2",
"react-sizeme": "^2.3.6",
"react-toggle": "4.0.2",
"reactcss": "1.2.3",
"redux": "3.7.2",
"redux": "4.0.0",
"redux-actions": "2.2.1",
"redux-thunk": "2.2.0",
"redux-thunk": "2.3.0",
"regression": "2.0.0",
"request": "^2.85.0",
"reselect": "^3.0.1",
Expand Down Expand Up @@ -252,8 +252,7 @@
"@types/prop-types": "^15.5.3",
"@types/react": "^16.3.14",
"@types/react-dom": "^16.0.5",
"@types/react-redux": "^5.0.6",
"@types/redux": "^3.6.31",
"@types/react-redux": "^6.0.6",
"@types/redux-actions": "^2.2.1",
"@types/sinon": "^5.0.0",
"@types/strip-ansi": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/

import _ from 'lodash';
import { Dispatch } from 'redux';
import { createAction } from 'redux-actions';
import { CoreKibanaState, getEmbeddableCustomization, getPanel } from '../../selectors';
import { getEmbeddableCustomization, getPanel } from '../../selectors';
import { PanelId, PanelState } from '../selectors';
import { updatePanel } from './panels';

import { EmbeddableMetadata, EmbeddableState } from 'ui/embeddable';
import { KibanaAction } from '../../selectors/types';
import { KibanaAction, KibanaThunk } from '../../selectors/types';

export enum EmbeddableActionTypeKeys {
EMBEDDABLE_IS_INITIALIZING = 'EMBEDDABLE_IS_INITIALIZING',
Expand Down Expand Up @@ -100,9 +99,9 @@ export const embeddableError = createAction<EmbeddableErrorActionPayload>(
export function embeddableStateChanged(changeData: {
panelId: PanelId;
embeddableState: EmbeddableState;
}) {
}): KibanaThunk {
const { panelId, embeddableState } = changeData;
return (dispatch: Dispatch<CoreKibanaState>, getState: () => CoreKibanaState) => {
return (dispatch, getState) => {
// Translate embeddableState to things redux cares about.
const customization = getEmbeddableCustomization(getState(), panelId);
if (!_.isEqual(embeddableState.customization, customization)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { EuiContextMenuPanelDescriptor } from '@elastic/eui';
import * as Redux from 'react-redux';
import { connect } from 'react-redux';
import { ContainerState, Embeddable } from 'ui/embeddable';
import { panelActionsStore } from '../../store/panel_actions_store';
import {
Expand All @@ -41,6 +41,7 @@ import {
setVisibleContextMenuPanelId,
} from '../../actions';

import { Dispatch } from 'redux';
import { DashboardContextMenuPanel } from 'ui/dashboard_panel_actions';
import { CoreKibanaState } from '../../../selectors';
import { DashboardViewMode } from '../../dashboard_view_mode';
Expand Down Expand Up @@ -106,7 +107,7 @@ const mapStateToProps = (
* @param panelId {string}
*/
const mapDispatchToProps = (
dispatch: Redux.Dispatch<CoreKibanaState>,
dispatch: Dispatch,
{ panelId }: PanelOptionsMenuContainerOwnProps
) => ({
onDeletePanel: () => {
Expand Down Expand Up @@ -200,7 +201,7 @@ const mergeProps = (
};
};

export const PanelOptionsMenuContainer = Redux.connect<
export const PanelOptionsMenuContainer = connect<
PanelOptionsMenuContainerStateProps,
PanelOptionsMenuContainerDispatchProps,
PanelOptionsMenuContainerOwnProps,
Expand Down
8 changes: 8 additions & 0 deletions src/core_plugins/kibana/public/selectors/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { Action } from 'redux';
import { ThunkAction } from 'redux-thunk';
import { DashboardState } from '../dashboard/selectors';

export interface CoreKibanaState {
Expand All @@ -28,3 +29,10 @@ export interface KibanaAction<T, P> extends Action {
readonly type: T;
readonly payload: P;
}

export type KibanaThunk<
R = Action | Promise<Action> | void,
S = CoreKibanaState,
E = any,
A extends Action = Action
> = ThunkAction<R, S, E, A>;
3 changes: 1 addition & 2 deletions src/core_plugins/kibana/public/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ import thunk from 'redux-thunk';
import { QueryLanguageType } from 'ui/embeddable/types';
import { DashboardViewMode } from './dashboard/dashboard_view_mode';
import { reducers } from './reducers';
import { CoreKibanaState } from './selectors';

const enhancers = [applyMiddleware(thunk)];

export const store = createStore<CoreKibanaState>(
export const store = createStore(
reducers,
{
dashboard: {
Expand Down
35 changes: 9 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,12 @@
"@types/node" "*"
"@types/react" "*"

"@types/react-redux@^5.0.6":
version "5.0.21"
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-5.0.21.tgz#98a3a371dfc22c894889f660d7515717639d20f4"
"@types/react-redux@^6.0.6":
version "6.0.6"
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-6.0.6.tgz#87f1d0a6ea901b93fcaf95fa57641ff64079d277"
dependencies:
"@types/react" "*"
redux "^3.6.0"
redux "^4.0.0"

"@types/react@*", "@types/react@^16.3.14":
version "16.3.14"
Expand All @@ -512,10 +512,6 @@
version "2.3.0"
resolved "https://registry.yarnpkg.com/@types/redux-actions/-/redux-actions-2.3.0.tgz#d28d7913ec86ee9e20ecb33a1fed887ecb538149"

"@types/redux@^3.6.31":
version "3.6.31"
resolved "https://registry.yarnpkg.com/@types/redux/-/redux-3.6.31.tgz#40eafa7575db36b912ce0059b85de98c205b0708"

"@types/retry@*", "@types/retry@^0.10.2":
version "0.10.2"
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.10.2.tgz#bd1740c4ad51966609b058803ee6874577848b37"
Expand Down Expand Up @@ -8240,7 +8236,7 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"

lodash-es@^4.17.4, lodash-es@^4.17.5, lodash-es@^4.2.1:
lodash-es@^4.17.4, lodash-es@^4.17.5:
version "4.17.7"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.7.tgz#db240a3252c3dd8360201ac9feef91ac977ea856"

Expand Down Expand Up @@ -8531,7 +8527,7 @@ lodash@^4.0.0, lodash@^4.17.10:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"

lodash@^4.0.1, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.1, lodash@^4.8.2, lodash@~4.17.4, lodash@~4.17.5:
lodash@^4.0.1, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.1, lodash@^4.8.2, lodash@~4.17.4, lodash@~4.17.5:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"

Expand Down Expand Up @@ -10972,7 +10968,7 @@ react-redux-request@^1.5.6:
lodash.isequal "^4.5.0"
prop-types "^15.6.1"

react-redux@^5.0.6, react-redux@^5.0.7:
react-redux@^5.0.7:
version "5.0.7"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.7.tgz#0dc1076d9afb4670f993ffaef44b8f8c1155a4c8"
dependencies:
Expand Down Expand Up @@ -11322,24 +11318,11 @@ redux-actions@2.2.1:
lodash-es "^4.17.4"
reduce-reducers "^0.1.0"

redux-thunk@2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.2.0.tgz#e615a16e16b47a19a515766133d1e3e99b7852e5"

redux-thunk@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"

redux@3.7.2, redux@^3.6.0:
version "3.7.2"
resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b"
dependencies:
lodash "^4.2.1"
lodash-es "^4.2.1"
loose-envify "^1.1.0"
symbol-observable "^1.0.3"

redux@4.0.0:
redux@4.0.0, redux@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
dependencies:
Expand Down Expand Up @@ -12786,7 +12769,7 @@ svgo@^0.7.0:
sax "~1.2.1"
whet.extend "~0.9.9"

symbol-observable@^1.0.3, symbol-observable@^1.1.0, symbol-observable@^1.2.0:
symbol-observable@^1.1.0, symbol-observable@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"

Expand Down

0 comments on commit 44113be

Please sign in to comment.