diff --git a/.flowconfig b/.flowconfig index a3a80352..97214ee1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -6,7 +6,6 @@ .*/node_modules/react-redux/.* .*/node_modules/redux/.* .*/node_modules/react-router/.* -.*/node_modules/react-router-redux/.* .*/node_modules/oboe/test/.* .*/_old/.* .*/scripts/solidity/.* @@ -17,7 +16,7 @@ ./src/flowtype/npm/react-redux_v5.x.x.js ./src/flowtype/npm/react-router_v4.x.x.js ./src/flowtype/npm/react-router-dom_v4.x.x.js -./src/flowtype/npm/react-router-redux.js +./src/flowtype/npm/connected-react-router.js ./src/flowtype/npm/bignumber.js ./src/flowtype/npm/ethereum-types.js ./src/flowtype/npm/web3.js diff --git a/src/actions/RouterActions.js b/src/actions/RouterActions.js index 440f991a..3d501714 100644 --- a/src/actions/RouterActions.js +++ b/src/actions/RouterActions.js @@ -52,7 +52,6 @@ export const pathToParams = (path: string): PayloadAction = export const paramsValidation = (params: RouterLocationState): PayloadAction => (dispatch: Dispatch, getState: GetState): boolean => { // validate requested device - console.log('params', params); if (params.hasOwnProperty('device')) { const { devices } = getState(); @@ -140,8 +139,6 @@ export const getValidUrl = (action: RouterAction): PayloadAction => (dis return '/'; } - console.log('action', action); - const requestedUrl = action.payload.location.pathname; // Corner case: LOCATION_CHANGE was called but pathname didn't changed (redirect action from RouterService) if (requestedUrl === location.pathname) return requestedUrl; @@ -277,7 +274,6 @@ export const selectFirstAvailableDevice = (gotoRoot: boolean = false): ThunkActi const url = dispatch(getFirstAvailableDeviceUrl()); if (url) { const currentParams = getState().router.location.state; - console.log('currentParams', currentParams); const requestedParams = dispatch(pathToParams(url)); if (gotoRoot || currentParams.device !== requestedParams.device || currentParams.deviceInstance !== requestedParams.deviceInstance) { dispatch(goto(url)); diff --git a/src/flowtype/npm/react-router-redux.js b/src/flowtype/npm/connected-react-router.js similarity index 99% rename from src/flowtype/npm/react-router-redux.js rename to src/flowtype/npm/connected-react-router.js index 98040f88..6fbbffda 100644 --- a/src/flowtype/npm/react-router-redux.js +++ b/src/flowtype/npm/connected-react-router.js @@ -42,5 +42,5 @@ declare module 'connected-react-router' { declare export class ConnectedRouter extends React$Component<{ history: any - }> {} + }> {} } \ No newline at end of file diff --git a/src/reducers/index.js b/src/reducers/index.js index fea2abc5..00181970 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -1,6 +1,7 @@ /* @flow */ import { combineReducers } from 'redux'; import { connectRouter } from 'connected-react-router'; +import type { State } from 'connected-react-router'; import log from 'reducers/LogReducer'; import localStorage from 'reducers/LocalStorageReducer'; @@ -23,8 +24,7 @@ import devices from 'reducers/DevicesReducer'; import blockchain from 'reducers/BlockchainReducer'; import signVerify from 'reducers/SignVerifyReducer'; -export default history => combineReducers({ - router: connectRouter(history), +const reducers = { log, localStorage, connect, @@ -45,8 +45,16 @@ export default history => combineReducers({ devices, blockchain, signVerify, -}); + router: () => ({ + location: {}, hash: {}, state: {}, network: {}, + }: State), +}; export type Reducers = typeof reducers; type $ExtractFunctionReturn = (v: (...args: any) => V) => V; export type ReducersState = $ObjMap; + +export default (history: any) => combineReducers({ + ...reducers, + router: connectRouter(history), +}); \ No newline at end of file diff --git a/src/services/RouterService.js b/src/services/RouterService.js index d1ff6407..66fa821b 100644 --- a/src/services/RouterService.js +++ b/src/services/RouterService.js @@ -25,10 +25,8 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa const validUrl = api.dispatch(RouterActions.getValidUrl(action)); // override action state (to be stored in RouterReducer) const override = action; - console.log('api.dispatch(RouterActions.pathToParams(validUrl))', api.dispatch(RouterActions.pathToParams(validUrl))); override.payload.location.state = api.dispatch(RouterActions.pathToParams(validUrl)); const redirect = action.payload.location.pathname !== validUrl; - console.warn('OVERRIDE', action.payload.location.pathname, validUrl); if (redirect) { // override action pathname override.payload.location.pathname = validUrl; diff --git a/src/views/Wallet/index.js b/src/views/Wallet/index.js index 9fcdee17..78679df7 100644 --- a/src/views/Wallet/index.js +++ b/src/views/Wallet/index.js @@ -96,7 +96,6 @@ const Wallet = (props: WalletContainerProps) => ( - {JSON.stringify(props.wallet)} { props.children }