1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-03 21:00:55 +00:00

Fix state propagation

This commit is contained in:
Vladimir Volek 2018-12-20 15:20:02 +01:00 committed by Szymon Lesisz
parent 786303400c
commit 5a6ea6610e
3 changed files with 5 additions and 1 deletions

View File

@ -51,6 +51,8 @@ export const pathToParams = (path: string): PayloadAction<RouterLocationState> =
*/ */
export const paramsValidation = (params: RouterLocationState): PayloadAction<boolean> => (dispatch: Dispatch, getState: GetState): boolean => { export const paramsValidation = (params: RouterLocationState): PayloadAction<boolean> => (dispatch: Dispatch, getState: GetState): boolean => {
// validate requested device // validate requested device
console.log('params', params);
if (params.hasOwnProperty('device')) { if (params.hasOwnProperty('device')) {
const { devices } = getState(); const { devices } = getState();

View File

@ -25,7 +25,8 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
const validUrl = api.dispatch(RouterActions.getValidUrl(action)); const validUrl = api.dispatch(RouterActions.getValidUrl(action));
// override action state (to be stored in RouterReducer) // override action state (to be stored in RouterReducer)
const override = action; const override = action;
override.payload.state = api.dispatch(RouterActions.pathToParams(validUrl)); 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; const redirect = action.payload.location.pathname !== validUrl;
if (redirect) { if (redirect) {
// override action pathname // override action pathname

View File

@ -96,6 +96,7 @@ const Wallet = (props: WalletContainerProps) => (
<ContextNotifications /> <ContextNotifications />
<Log /> <Log />
<Body> <Body>
{JSON.stringify(props.wallet)}
{ props.children } { props.children }
</Body> </Body>
<Footer /> <Footer />