From 92e4c1f6d4f9ebd2aba905f30298ad59bf932274 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Thu, 3 Dec 2020 15:58:43 +0100 Subject: [PATCH] Bump more navigator frontend deps (#8141) changelog_begin changelog_end --- navigator/frontend/package.json | 50 +- .../frontend/src/applets/about/index.tsx | 23 +- navigator/frontend/src/applets/app/index.tsx | 13 +- .../src/applets/configsource/index.tsx | 21 +- .../frontend/src/applets/contract/index.tsx | 18 +- .../frontend/src/applets/contracts/index.tsx | 9 +- .../frontend/src/applets/customview/index.tsx | 15 +- navigator/frontend/src/applets/info/index.tsx | 20 +- .../frontend/src/applets/template/index.tsx | 18 +- .../src/applets/templatecontracts/index.tsx | 22 +- .../frontend/src/applets/templates/index.tsx | 11 +- navigator/frontend/src/components/Link.tsx | 8 +- navigator/frontend/src/components/Navbar.tsx | 29 +- navigator/frontend/src/index.tsx | 24 +- .../frontend/src/redux-router/src/index.ts | 12 +- navigator/frontend/src/types/index.ts | 11 - .../src/ui-core/src/Autosuggest/index.tsx | 2 +- .../src/ui-core/src/SidebarLink/index.tsx | 2 +- navigator/frontend/src/ui-core/src/index.ts | 2 - .../src/ui-core/src/ledger-watcher/UI.tsx | 16 +- .../frontend/src/ui-core/src/session/UI.tsx | 2 +- .../src/ui-core/src/session/actions.ts | 13 +- navigator/frontend/src/ui-core/src/types.ts | 34 +- .../src/ui-core/src/withLedgerTime/index.tsx | 5 +- navigator/frontend/yarn.lock | 1853 +++++++++-------- 25 files changed, 1116 insertions(+), 1117 deletions(-) diff --git a/navigator/frontend/package.json b/navigator/frontend/package.json index 8e64ef5cc6..5f17f463c1 100644 --- a/navigator/frontend/package.json +++ b/navigator/frontend/package.json @@ -20,23 +20,22 @@ "lint": "tslint --project tslint.json" }, "devDependencies": { - "@types/modernizr": "^3.5.3", - "@bazel/hide-bazel-files": "1.6.0", - "@types/async": "2.0.39", + "@bazel/hide-bazel-files": "^1.7.0", + "@types/async": "^3.2.5", "@types/babel-core": "^6.25.3", - "@types/classnames": "0.0.32", - "@types/color": "1.0.3", - "@types/deep-equal": "1.0.0", - "@types/lodash": "4.14.76", - "@types/react": "^16.9.41", - "@types/react-autosuggest": "8.0.1", - "@types/react-dom": "^16.9.8", + "@types/classnames": "^2.2.11", + "@types/color": "^3.0.1", + "@types/deep-equal": "^1.0.1", + "@types/lodash": "^4.14.76", + "@types/modernizr": "^3.5.3", + "@types/react": "^17.0.0", + "@types/react-autosuggest": "^10.0.1", + "@types/react-dom": "^17.0.0", "@types/react-overlays": "0.8.4", - "@types/react-redux": "^5.0.8 <5.0.13", + "@types/react-redux": "^7.1.11", "@types/react-virtualized": "9.7.4", "@types/route-parser": "0.0.0", "@types/styled-components": "^5.1.0", - "@types/uuidjs": "3.3.2", "apollo": "^2.31.1", "case-sensitive-paths-webpack-plugin": "2.2.0", "css-loader": "3.2.0", @@ -50,7 +49,7 @@ "style-loader": "1.0.0", "ts-loader": "6.2.1", "tsconfig-paths-webpack-plugin": "3.2.0", - "tslint": "5.20.1", + "tslint": "^5.20.1", "tslint-loader": "3.5.4", "tslint-react": "4.1.0", "typescript": "4.1.2", @@ -60,33 +59,34 @@ "webpack-dev-server": "3.9.0" }, "dependencies": { - "@apollo/client": "^3.2.9", + "@apollo/client": "^3.3.2", "babel-standalone": "^6.26.0", - "color": "1.0.3", - "deep-equal": "~1.0.1", + "color": "^3.0.1", + "deep-equal": "^2.0.5", "enzyme": "^3.11.0", "es6-promise": "^4.1.1", "graphql": "^15.4.0", + "jpeg-js": "^0.4.1", "lodash": "^4.17.19", "modernizr": "^3.11.4", "moment": "^2.23.0", "normalize.css": "^7.0.0", - "react": "^16.13.1", - "react-autosuggest": "9.3.2", - "react-dom": "^16.13.1", - "react-is": "^16.13.1", + "react": "^17.0.1", + "react-autosuggest": "^10.0.4", + "react-dom": "^17.0.1", + "react-is": "^17.0.1", "react-markdown": "2.5.0", "react-overlays": "1.0.0-beta.2", - "react-redux": "^5.0.5", + "react-redux": "^7.2.2", "react-virtualized": "^9.9.0", - "redux": "^3.7.0", - "redux-thunk": "~2.2.0", + "redux": "^4.0.5", + "redux-thunk": "^2.3.0", "route-parser": "0.0.5", "styled-components": "^5.1.1", "subscriptions-transport-ws": "^0.9.18", "typescript-collections": "1.2.5", - "uuidjs": "3.5.3", - "whatwg-fetch": "^2.0.3" + "uuidjs": "^4.2.6", + "whatwg-fetch": "^3.5.0" }, "resolutions": { "**/elliptic": "^6.5.3", diff --git a/navigator/frontend/src/applets/about/index.tsx b/navigator/frontend/src/applets/about/index.tsx index e16e250541..eb179f34c9 100644 --- a/navigator/frontend/src/applets/about/index.tsx +++ b/navigator/frontend/src/applets/about/index.tsx @@ -1,11 +1,10 @@ // Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { Dispatch, styled, ThunkAction } from '@da/ui-core'; +import { Dispatch, styled } from '@da/ui-core'; import * as React from 'react'; -import { connect } from 'react-redux'; -import { compose } from 'redux'; -import { Connect } from '../../types'; +import { connect, ConnectedComponent } from 'react-redux'; +import { ThunkAction, ThunkDispatch } from 'redux-thunk'; import * as App from '../app'; export type Action @@ -38,7 +37,7 @@ export interface State { backendVersionInfo: BackendVersionInfoResult; } -export type ToSelf = (action: Action | ThunkAction) => App.Action; +export type ToSelf = (action: Action | ThunkAction) => App.Action; export function init(): State { return { @@ -46,7 +45,7 @@ export function init(): State { }; } -export function reloadBackendInfo(toSelf: ToSelf): ThunkAction { +export function reloadBackendInfo(toSelf: ToSelf): ThunkAction { return (dispatch) => { dispatch(toSelf(setBackendInfoLoading())); @@ -65,13 +64,13 @@ export function reloadBackendInfo(toSelf: ToSelf): ThunkAction { }; } -function handleBackendInfoResponse(to: ToSelf, dispatch: Dispatch) { +function handleBackendInfoResponse(to: ToSelf, dispatch: Dispatch) { return (source: BackendVersionInfo): void => { dispatch(to(setBackendInfoResult(source))); }; } -function handleBackendInfoFetchError(to: ToSelf, dispatch: Dispatch) { +function handleBackendInfoFetchError(to: ToSelf, dispatch: Dispatch) { // tslint:disable-next-line no-any return (reason: any) => { if (reason instanceof Error) { @@ -119,12 +118,12 @@ interface OwnProps { toSelf: ToSelf; } interface ReduxProps { - dispatch: Dispatch; + dispatch: ThunkDispatch; } type Props = OwnProps & ReduxProps; -const BackendInfo: React.StatelessComponent<{info: BackendVersionInfoResult}> +const BackendInfo: React.FC<{info: BackendVersionInfoResult}> = ({info}) => { switch (info.type) { case 'none': return

; @@ -169,6 +168,4 @@ class Component extends React.Component { } }; -const withRedux: Connect = connect(); - -export const UI = compose(withRedux)(Component); +export const UI: ConnectedComponent = connect()(Component); diff --git a/navigator/frontend/src/applets/app/index.tsx b/navigator/frontend/src/applets/app/index.tsx index 86403924b3..87b4f70b25 100644 --- a/navigator/frontend/src/applets/app/index.tsx +++ b/navigator/frontend/src/applets/app/index.tsx @@ -5,7 +5,7 @@ import { defaultTheme, Dispatch, ThemeInterface, ThemeProvider } from '@da/ui-co import * as LedgerWatcher from '@da/ui-core/lib/ledger-watcher'; import * as Session from '@da/ui-core/lib/session'; import * as React from 'react'; -import { connect } from 'react-redux'; +import { connect, ConnectedComponent } from 'react-redux'; import { Action as ReduxAction } from 'redux'; import Frame from '../../components/Frame'; import { @@ -17,7 +17,6 @@ import { } from '../../config'; import * as Either from '../../config/either'; import logoUrl from '../../images/logo-large.png'; -import { Connect } from '../../types'; import * as ConfigSource from '../configsource'; import * as Page from '../page'; @@ -243,11 +242,5 @@ class Component extends React.Component { } }; -const withRedux: Connect = - connect( - (state) => ({ state }), - (dispatch) => ({ dispatch }), - ); - - -export const UI = withRedux(Component); +export const UI: ConnectedComponent = + connect((state) => ({state}), (dispatch) => ({dispatch}))(Component); diff --git a/navigator/frontend/src/applets/configsource/index.tsx b/navigator/frontend/src/applets/configsource/index.tsx index 8a369a28e7..80abee20ba 100644 --- a/navigator/frontend/src/applets/configsource/index.tsx +++ b/navigator/frontend/src/applets/configsource/index.tsx @@ -1,13 +1,12 @@ // Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { Button, Dispatch, styled, ThunkAction } from '@da/ui-core'; +import { Button, styled } from '@da/ui-core'; import * as Session from '@da/ui-core/lib/session'; import * as React from 'react'; -import { connect } from 'react-redux'; -import { compose } from 'redux'; +import { connect, ConnectedComponent } from 'react-redux'; +import { ThunkAction, ThunkDispatch } from 'redux-thunk'; import { configFileAPI, ConfigType, prettyPrintConfig } from '../../config'; -import { Connect } from '../../types'; import * as App from '../app'; export type Action @@ -37,7 +36,7 @@ export interface State { result: StateResult; } -export type ToSelf = (action: Action | ThunkAction) => App.Action; +export type ToSelf = (action: Action | ThunkAction) => App.Action; export function init(): State { return { @@ -46,7 +45,7 @@ export function init(): State { }; } -export function reload(toSelf: ToSelf): ThunkAction { +export function reload(toSelf: ToSelf): ThunkAction { return (dispatch) => { dispatch(toSelf(setLoading())); @@ -71,13 +70,13 @@ export function reload(toSelf: ToSelf): ThunkAction { }; } -function handleResponse(to: ToSelf, dispatch: Dispatch) { +function handleResponse(to: ToSelf, dispatch: ThunkDispatch) { return (source: string): void => { dispatch(to(setSource(source))); }; } -function handleFetchError(to: ToSelf, dispatch: Dispatch) { +function handleFetchError(to: ToSelf, dispatch: ThunkDispatch) { // tslint:disable-next-line no-any return (reason: any) => { if (reason instanceof Error) { @@ -130,7 +129,7 @@ interface OwnProps { toSelf: ToSelf; } interface ReduxProps { - dispatch: Dispatch; + dispatch: ThunkDispatch; } type Props = OwnProps & ReduxProps; @@ -185,6 +184,4 @@ class Component extends React.Component { } }; -const withRedux: Connect = connect(); - -export const UI = compose(withRedux)(Component); +export const UI: ConnectedComponent = connect()(Component); diff --git a/navigator/frontend/src/applets/contract/index.tsx b/navigator/frontend/src/applets/contract/index.tsx index dbc8488dfd..ae533443c8 100644 --- a/navigator/frontend/src/applets/contract/index.tsx +++ b/navigator/frontend/src/applets/contract/index.tsx @@ -8,14 +8,12 @@ import { DamlLfValue } from '@da/ui-core/lib/api/DamlLfValue'; import * as LedgerWatcher from '@da/ui-core/lib/ledger-watcher'; import * as React from 'react'; import { connect } from 'react-redux'; -import { compose } from 'redux'; import { ContractDetailsById, ContractDetailsById_node_Contract, ContractDetailsByIdVariables, ContractExercise, } from '../../api/Queries'; -import { Connect } from '../../types'; import * as App from '../app'; import ContractComponent from './ContractComponent'; @@ -187,7 +185,7 @@ const mutation = gql` // generally confusing to say the least, but works out with a bit of care and // thinking about the ordering and what each connect function adds. -const _withMutation: Connect = +const _withMutation = withMutation(mutation, { props: ({mutate}): MutationProps => ({ @@ -197,8 +195,8 @@ const _withMutation: Connect = }, ); -const _withQuery: Connect = - withQuery(query, { +const _withQuery = + withQuery(query, { props: ({ data }) => { const node = data?.node; const contract = (node && node.__typename === 'Contract') ? node : null; @@ -210,11 +208,5 @@ const _withQuery: Connect = options: ({ state: { id } }: OwnProps) => ({ variables: { id } as ContractDetailsByIdVariables}), }); -const withRedux: Connect = - connect(); - -export const UI = compose( - _withMutation, - _withQuery, - withRedux, -)(Component); +export const UI: React.ComponentClass = + _withMutation(_withQuery(connect()(Component))); diff --git a/navigator/frontend/src/applets/contracts/index.tsx b/navigator/frontend/src/applets/contracts/index.tsx index 985661661c..da8f340205 100644 --- a/navigator/frontend/src/applets/contracts/index.tsx +++ b/navigator/frontend/src/applets/contracts/index.tsx @@ -12,10 +12,8 @@ import { import { User } from '@da/ui-core/lib/session'; import * as React from 'react'; import { connect } from 'react-redux'; -import { compose } from 'redux'; import { contract as contractRoute } from '../../routes'; import { pathToAction } from '../../routes'; -import { Connect } from '../../types'; import * as App from '../app'; import columns from './columns'; import { Contract, dataToRows, makeQueryVariables, query } from './data'; @@ -111,9 +109,4 @@ class Component extends React.Component { } } -const withRedux: Connect = connect(); - -export const UI: React.ComponentClass = compose( - (x) => withApollo(x), - withRedux, -)(Component); +export const UI: React.ComponentClass = withApollo(connect()(Component)); diff --git a/navigator/frontend/src/applets/customview/index.tsx b/navigator/frontend/src/applets/customview/index.tsx index 85880cc420..1f3c3d4ef3 100644 --- a/navigator/frontend/src/applets/customview/index.tsx +++ b/navigator/frontend/src/applets/customview/index.tsx @@ -1,16 +1,13 @@ // Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { - ChoicesButton, - Dispatch, - WithRedux, -} from '@da/ui-core'; +import { ChoicesButton } from '@da/ui-core'; import * as LedgerWatcher from '@da/ui-core/lib/ledger-watcher'; import * as Session from '@da/ui-core/lib/session'; import { CellRenderParams, ColumnConfig } from '@da/ui-core/lib/Table'; import * as React from 'react'; -import { connect } from 'react-redux'; +import { connect, ConnectedComponent } from 'react-redux'; +import { ThunkDispatch } from 'redux-thunk'; import Link from '../../components/Link'; import { ConfigInterface, ConfigType } from '../../config'; import * as Routes from '../../routes'; @@ -139,7 +136,7 @@ interface OwnProps { } interface DispatchProps { - dispatch: Dispatch; + dispatch: ThunkDispatch; } type Props = DispatchProps & OwnProps; @@ -311,6 +308,4 @@ class Component extends React.Component { } } -const withRedux: WithRedux = connect(); - -export const UI = withRedux(Component); +export const UI: ConnectedComponent = connect()(Component); diff --git a/navigator/frontend/src/applets/info/index.tsx b/navigator/frontend/src/applets/info/index.tsx index 11c5ba9ed0..f02655a6fb 100644 --- a/navigator/frontend/src/applets/info/index.tsx +++ b/navigator/frontend/src/applets/info/index.tsx @@ -4,11 +4,11 @@ // Copyright (c) 2020, Digital Asset (Switzerland) GmbH and/or its affiliates. // All rights reserved. -import { Dispatch, styled, ThunkAction } from '@da/ui-core'; +import { Dispatch, styled } from '@da/ui-core'; import * as React from 'react'; -import { connect } from 'react-redux'; -import { compose } from 'redux'; -import { Connect } from '../../types'; +import { connect, ConnectedComponent } from 'react-redux'; +import { AnyAction } from 'redux'; +import { ThunkAction, ThunkDispatch } from 'redux-thunk'; import * as App from '../app'; // The backend returns an opaque JSON object @@ -38,7 +38,7 @@ export interface State { backendInfo: BackendInfoResult; } -export type ToSelf = (action: Action | ThunkAction) => App.Action; +export type ToSelf = (action: Action | ThunkAction) => App.Action; export function init(): State { return { @@ -46,7 +46,7 @@ export function init(): State { }; } -export function reloadBackendInfo(toSelf: ToSelf): ThunkAction { +export function reloadBackendInfo(toSelf: ToSelf): ThunkAction { return (dispatch) => { dispatch(toSelf(setBackendInfoLoading())); @@ -65,13 +65,13 @@ export function reloadBackendInfo(toSelf: ToSelf): ThunkAction { }; } -function handleBackendInfoResponse(to: ToSelf, dispatch: Dispatch) { +function handleBackendInfoResponse(to: ToSelf, dispatch: ThunkDispatch) { return (source: Object): void => { dispatch(to(setBackendInfoResult(source))); }; } -function handleBackendInfoFetchError(to: ToSelf, dispatch: Dispatch) { +function handleBackendInfoFetchError(to: ToSelf, dispatch: ThunkDispatch) { // tslint:disable-next-line no-any return (reason: any) => { if (reason instanceof Error) { @@ -154,6 +154,4 @@ class Component extends React.Component { } }; -const withRedux: Connect = connect(); - -export const UI = compose(withRedux)(Component); +export const UI: ConnectedComponent = connect()(Component); diff --git a/navigator/frontend/src/applets/template/index.tsx b/navigator/frontend/src/applets/template/index.tsx index 061bfc410f..df848a4f4b 100644 --- a/navigator/frontend/src/applets/template/index.tsx +++ b/navigator/frontend/src/applets/template/index.tsx @@ -8,7 +8,6 @@ import { DamlLfValue } from '@da/ui-core/lib/api/DamlLfValue'; import * as LedgerWatcher from '@da/ui-core/lib/ledger-watcher'; import * as React from 'react'; import { connect } from 'react-redux'; -import { compose } from 'redux'; import { CreateContract, CreateContractVariables, @@ -18,7 +17,6 @@ import { } from '../../api/Queries'; import { pathToAction } from '../../routes'; import { contracts as dashboardRoute } from '../../routes'; -import { Connect } from '../../types'; import * as App from '../app'; import TemplateComponent from './TemplateComponent'; @@ -142,7 +140,7 @@ const mutation = gql` * - the contract data fetched from the GraphQL API */ -const _withMutation: Connect = +const _withMutation = withMutation(mutation, { props: ({ mutate }) => ({ create: mutate && ((templateId: string, argument: DamlLfValue) => @@ -150,17 +148,11 @@ const _withMutation: Connect = )}), }); -const _withQuery: Connect = - withQuery(query, { +const _withQuery = + withQuery(query, { options: ({ state: { id } }) => ({ variables: { templateId: id } }), }); -const withRedux: Connect = - connect(); - -export const UI = compose( - _withMutation, - _withQuery, - withRedux, -)(Component); +export const UI: React.ComponentClass = + _withMutation(_withQuery(connect()(Component))); diff --git a/navigator/frontend/src/applets/templatecontracts/index.tsx b/navigator/frontend/src/applets/templatecontracts/index.tsx index 1bc138522e..747a41b220 100644 --- a/navigator/frontend/src/applets/templatecontracts/index.tsx +++ b/navigator/frontend/src/applets/templatecontracts/index.tsx @@ -14,11 +14,9 @@ import { import { User } from '@da/ui-core/lib/session'; import * as React from 'react'; import { connect } from 'react-redux'; -import { compose } from 'redux'; import { ContractsByTemplateParamQuery, ContractsByTemplateParamQueryVariables } from 'src/api/Queries'; import { contract as contractRoute } from '../../routes'; import { pathToAction } from '../../routes'; -import { Connect } from '../../types'; import * as App from '../app'; import makeColumns from './columns'; import { @@ -132,14 +130,18 @@ class Component extends React.Component { } } -const withRedux: Connect = connect(); -const withGraphQL: Connect +const withGraphQL = - withQuery( + withQuery< + ReduxProps & ApolloProps & OwnProps, + ContractsByTemplateParamQuery, + ContractsByTemplateParamQueryVariables, + GraphQLProps>( paramQuery, { options: (s) => makeParamQueryVariables(s) }); -export const UI: React.ComponentClass = compose( - (x) => withApollo(x), - withRedux, - withGraphQL, -)(Component); +export const UI: React.ComponentClass = + withApollo( + connect()( + withGraphQL(Component), + ), + ); diff --git a/navigator/frontend/src/applets/templates/index.tsx b/navigator/frontend/src/applets/templates/index.tsx index 104b9c2e1b..c169554ed7 100644 --- a/navigator/frontend/src/applets/templates/index.tsx +++ b/navigator/frontend/src/applets/templates/index.tsx @@ -9,15 +9,12 @@ import { Dispatch, WithGraphQL, - WithRedux, } from '@da/ui-core'; import { User } from '@da/ui-core/lib/session'; import * as React from 'react'; import { connect } from 'react-redux'; -import { compose } from 'redux'; import { template as templateRoute } from '../../routes'; import { pathToAction } from '../../routes'; -import { Connect } from '../../types'; import * as App from '../app'; import columns from './columns'; import { @@ -120,10 +117,4 @@ class Component } } -const withRedux: WithRedux = connect(); -const _withApollo: Connect> = (x) => withApollo(x); - -export const UI: React.ComponentClass = compose( - _withApollo, - withRedux, -)(Component); +export const UI: React.ComponentClass = withApollo(connect()(Component)); diff --git a/navigator/frontend/src/components/Link.tsx b/navigator/frontend/src/components/Link.tsx index 5b432fc266..0eba0981e2 100644 --- a/navigator/frontend/src/components/Link.tsx +++ b/navigator/frontend/src/components/Link.tsx @@ -4,10 +4,9 @@ import { Dispatch, Route } from '@da/ui-core'; import UntypedLink, { HrefTarget } from '@da/ui-core/lib/Link'; import * as React from 'react'; -import { connect } from 'react-redux'; +import { connect, ConnectedComponent } from 'react-redux'; import * as App from '../applets/app' import { pathToAction } from '../routes'; -import { Connect } from '../types'; // Note: The react-redux typings for connect() try to remove // the 'dispatch' property from OwnProps. This makes sense since react-redux @@ -58,6 +57,5 @@ class Link extends React.Component { } } -const withRedux: Connect = connect(); - -export default withRedux(Link); +const C: ConnectedComponent> = connect()(Link); +export default C; diff --git a/navigator/frontend/src/components/Navbar.tsx b/navigator/frontend/src/components/Navbar.tsx index c4cbf737e8..0c9a366f24 100644 --- a/navigator/frontend/src/components/Navbar.tsx +++ b/navigator/frontend/src/components/Navbar.tsx @@ -1,11 +1,15 @@ // Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { AdvanceTime, Button, Dispatch, NavBar, ThunkAction } from '@da/ui-core'; +import { ApolloClient } from '@apollo/client'; +import { withApollo } from '@apollo/client/react/hoc'; +import { AdvanceTime, Button, Dispatch, NavBar } from '@da/ui-core'; import * as LedgerWatcher from '@da/ui-core/lib/ledger-watcher'; import * as Session from '@da/ui-core/lib/session'; import * as React from 'react'; -import { connect } from 'react-redux'; +import { connect, ConnectedComponent } from 'react-redux'; +import { AnyAction } from 'redux'; +import { ThunkAction } from 'redux-thunk' import styled from 'styled-components'; import * as App from '../applets/app'; import logoUrl from '../images/logo-large.png'; @@ -13,13 +17,14 @@ import { about } from '../routes'; import { Icon } from './Icon'; import Link from './Link'; -function signOut(toSession: (action: Session.Action) => App.Action) { - return Session.signOut(toSession, ((dispatch) => { - dispatch({ type: 'APOLLO_STORE_RESET', observableQueryIds: [] }); +// tslint:disable-next-line:no-any +function signOut(client: ApolloClient, toSession: (action: Session.Action) => App.Action) { + return Session.signOut(toSession, ((dispatch: Dispatch) => { + client.resetStore(); dispatch(App.resetApp()); // Session.signOut signature can't handle ThunkAction // tslint:disable-next-line - }) as ThunkAction as any); + }) as ThunkAction as any); } interface ReduxProps { @@ -31,7 +36,8 @@ interface OwnProps { user: Session.User; watcher: LedgerWatcher.State; } -type Props = ReduxProps & OwnProps; +// tslint:disable-next-line:no-any +type Props = ReduxProps & OwnProps & { client: ApolloClient }; const InlineDiv = styled.div` display: inline; @@ -80,12 +86,13 @@ const Component = ({ user, dispatch, watcher, + client, }: Props) => ( }>