diff --git a/app/package.json b/app/package.json index 90cbacf8958..c3b2a9407b5 100644 --- a/app/package.json +++ b/app/package.json @@ -25,7 +25,7 @@ "@opentrons/shared-data": "3.12.0", "@thi.ng/paths": "^1.6.5", "classnames": "^2.2.5", - "connected-react-router": "^6.4.0", + "connected-react-router": "^6.5.2", "events": "^3.0.0", "formik": "^1.3.1", "history": "^4.7.2", @@ -37,8 +37,7 @@ "react-dom": "^16.8.6", "react-hot-loader": "^3.0.0-beta.7", "react-redux": "^7.1.0", - "react-router": "^4.2.0", - "react-router-dom": "^4.2.2", + "react-router-dom": "^5.0.1", "redux": "^4.0.1", "redux-observable": "^1.1.0", "redux-thunk": "^2.3.0", diff --git a/app/src/components/App.js b/app/src/components/App.js index cf40940ac94..9f22ec86ee9 100644 --- a/app/src/components/App.js +++ b/app/src/components/App.js @@ -1,5 +1,5 @@ import React from 'react' -import { Switch, Route, Redirect } from 'react-router' +import { Switch, Route, Redirect } from 'react-router-dom' import NavBar from './nav-bar' diff --git a/app/src/components/AppSettings/AdvancedSettingsCard.js b/app/src/components/AppSettings/AdvancedSettingsCard.js index 6e78fdb2c1b..9d50b5bbd0f 100644 --- a/app/src/components/AppSettings/AdvancedSettingsCard.js +++ b/app/src/components/AppSettings/AdvancedSettingsCard.js @@ -19,7 +19,7 @@ import { Card } from '@opentrons/components' import { LabeledToggle, LabeledSelect, LabeledButton } from '../controls' import AddManualIp from './AddManualIp' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { DropdownOption } from '@opentrons/components' import type { State, Dispatch } from '../../types' import type { UpdateChannel } from '../../config/types' diff --git a/app/src/components/CalibrateDeck/index.js b/app/src/components/CalibrateDeck/index.js index 87c7449baf0..a57c5d1efa3 100644 --- a/app/src/components/CalibrateDeck/index.js +++ b/app/src/components/CalibrateDeck/index.js @@ -2,17 +2,10 @@ import * as React from 'react' import { connect } from 'react-redux' import { push, goBack } from 'connected-react-router' -import { Switch, Route, withRouter } from 'react-router' +import { Switch, Route, withRouter } from 'react-router-dom' import type { State, Dispatch } from '../../types' -import type { - WithRouterOP, - OP, - SP, - DP, - CalibrateDeckProps, - CalibrationStep, -} from './types' +import type { OP, SP, DP, CalibrateDeckProps, CalibrationStep } from './types' import { getPipetteModelSpecs } from '@opentrons/shared-data' import { chainActions } from '../../util' @@ -41,7 +34,7 @@ const BAD_PIPETTE_ERROR = 'Unexpected pipette response from robot' const ERROR_DESCRIPTION = 'An unexpected error has cleared your deck calibration progress, please try again.' -export default withRouter( +export default withRouter<_, _>( connect( makeMapStateToProps, mapDispatchToProps diff --git a/app/src/components/CalibrateDeck/types.js b/app/src/components/CalibrateDeck/types.js index b4030fca606..61095581f4d 100644 --- a/app/src/components/CalibrateDeck/types.js +++ b/app/src/components/CalibrateDeck/types.js @@ -1,5 +1,5 @@ // @flow -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { PipetteModelSpecs } from '@opentrons/shared-data' import type { RobotService, Mount } from '../../robot' import type { @@ -10,14 +10,10 @@ import type { Jog } from '../JogControls' export type CalibrationStep = '1' | '2' | '3' | '4' | '5' | '6' -export type WithRouterOP = {| - robot: RobotService, - parentUrl: string, -|} - export type OP = {| ...ContextRouter, - ...WithRouterOP, + robot: RobotService, + parentUrl: string, |} export type SP = {| diff --git a/app/src/components/CalibrateLabware/index.js b/app/src/components/CalibrateLabware/index.js index 11a860132b3..f94bb4a159f 100644 --- a/app/src/components/CalibrateLabware/index.js +++ b/app/src/components/CalibrateLabware/index.js @@ -1,7 +1,7 @@ // @flow // info panel and controls for labware calibration page import * as React from 'react' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import type { Labware } from '../../robot' import DeckMap from '../DeckMap' import InfoBox from './InfoBox' @@ -9,7 +9,7 @@ import styles from './styles.css' type Props = { labware: ?Labware } -export default withRouter<$Exact>(CalibrateLabware) +export default withRouter<$Exact, _>(CalibrateLabware) function CalibrateLabware(props: Props) { return ( diff --git a/app/src/components/CalibratePanel/LabwareList.js b/app/src/components/CalibratePanel/LabwareList.js index 5340b0f0169..93cac01558e 100644 --- a/app/src/components/CalibratePanel/LabwareList.js +++ b/app/src/components/CalibratePanel/LabwareList.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import { TitledList } from '@opentrons/components' import LabwareListItem from './LabwareListItem' @@ -31,7 +31,7 @@ type Props = { setLabware: (labware: Labware) => mixed, } -export default withRouter<{||}>( +export default withRouter<{||}, _>( connect( mapStateToProps, null, diff --git a/app/src/components/CalibratePanel/PipetteList.js b/app/src/components/CalibratePanel/PipetteList.js index 0ad7f0fa0e8..a3fc50b5fe2 100644 --- a/app/src/components/CalibratePanel/PipetteList.js +++ b/app/src/components/CalibratePanel/PipetteList.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import { constants as robotConstants, @@ -19,7 +19,7 @@ type Props = { const TITLE = 'Pipette Calibration' -export default withRouter<{||}>( +export default withRouter<{||}, _>( connect(mapStateToProps)(PipetteList) ) diff --git a/app/src/components/CalibratePanel/TipRackList.js b/app/src/components/CalibratePanel/TipRackList.js index 8ead84b9c63..0194bc9e18f 100644 --- a/app/src/components/CalibratePanel/TipRackList.js +++ b/app/src/components/CalibratePanel/TipRackList.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import { TitledList } from '@opentrons/components' import LabwareListItem from './LabwareListItem' @@ -11,9 +11,12 @@ import { actions as robotActions, } from '../../robot' +import type { ContextRouter } from 'react-router-dom' import type { State, Dispatch } from '../../types' import type { Labware, Mount } from '../../robot' +type OP = ContextRouter + type SP = {| disabled: boolean, tipracks: Array, @@ -23,14 +26,14 @@ type SP = {| type DP = {| dispatch: Dispatch |} -type Props = { +type Props = {| tipracks: Array, disabled: boolean, setLabware: (labware: Labware) => mixed, -} +|} -export default withRouter<{||}>( - connect( +export default withRouter<_, _>( + connect( mapStateToProps, null, mergeProps @@ -64,7 +67,7 @@ function mapStateToProps(state: State): SP { } } -function mergeProps(stateProps: SP, dispatchProps: DP): Props { +function mergeProps(stateProps: SP, dispatchProps: DP, ownProps: OP): Props { const { tipracks, disabled, _calibrator, _deckPopulated } = stateProps const { dispatch } = dispatchProps diff --git a/app/src/components/ChangePipette/InstructionStep.js b/app/src/components/ChangePipette/InstructionStep.js index 5de101a4d68..56ed1cf54d6 100644 --- a/app/src/components/ChangePipette/InstructionStep.js +++ b/app/src/components/ChangePipette/InstructionStep.js @@ -18,7 +18,7 @@ type DiagramProps = { mount: Mount, channels: PipetteChannels, diagram: Diagram, - displayCategory: PipetteDisplayCategory, + displayCategory: ?PipetteDisplayCategory, } type Props = DiagramProps & { diff --git a/app/src/components/ChangePipette/index.js b/app/src/components/ChangePipette/index.js index 8183a7f6737..7242be7e801 100644 --- a/app/src/components/ChangePipette/index.js +++ b/app/src/components/ChangePipette/index.js @@ -2,14 +2,24 @@ import * as React from 'react' import { connect } from 'react-redux' import { push, goBack } from 'connected-react-router' -import { Switch, Route, withRouter, type Match } from 'react-router' +import { Switch, Route, withRouter } from 'react-router-dom' import { getPipetteNameSpecs, getPipetteModelSpecs, type PipetteDisplayCategory, } from '@opentrons/shared-data' + import { getConfig } from '../../config' +import { fetchPipettes, getPipettesState } from '../../robot-api' +import { + home, + moveRobotTo, + disengagePipetteMotors, + makeGetRobotMove, + makeGetRobotHome, +} from '../../http-api-client' +import type { ContextRouter } from 'react-router-dom' import type { PipetteNameSpecs, PipetteModelSpecs, @@ -19,15 +29,6 @@ import type { Mount } from '../../robot' import type { Robot } from '../../discovery' import type { Direction, ChangePipetteProps } from './types' import type { RobotHome, RobotMove } from '../../http-api-client' -import { - home, - moveRobotTo, - disengagePipetteMotors, - makeGetRobotMove, - makeGetRobotHome, -} from '../../http-api-client' - -import { fetchPipettes, getPipettesState } from '../../robot-api' import ClearDeckAlertModal from '../ClearDeckAlertModal' import ExitAlertModal from './ExitAlertModal' @@ -36,15 +37,11 @@ import Instructions from './Instructions' import ConfirmPipette from './ConfirmPipette' import RequestInProgressModal from './RequestInProgressModal' -type Props = { - match: Match, +type Props = {| + ...ContextRouter, robot: Robot, parentUrl: string, -} - -const TITLE = 'Pipette Setup' -// used to guarantee mount param in route is left or right -const RE_MOUNT = '(left|right)' +|} type OP = {| title: string, @@ -80,8 +77,12 @@ type DP = {| goToConfirmUrl: () => mixed, |} -const ConnectedChangePipetteRouter = withRouter( - connect( +const TITLE = 'Pipette Setup' +// used to guarantee mount param in route is left or right +const RE_MOUNT = '(left|right)' + +const ConnectedChangePipetteRouter = withRouter<_, _>( + connect( makeMapStateToProps, mapDispatchToProps )(ChangePipetteRouter) diff --git a/app/src/components/ChangePipette/types.js b/app/src/components/ChangePipette/types.js index c52a5b881dd..90939ca2e00 100644 --- a/app/src/components/ChangePipette/types.js +++ b/app/src/components/ChangePipette/types.js @@ -12,14 +12,14 @@ import type { PipetteSelectionProps } from './PipetteSelection' export type Direction = 'attach' | 'detach' -export type ChangePipetteProps = { +export type ChangePipetteProps = {| title: string, subtitle: string, mount: Mount, wantedPipette: ?PipetteNameSpecs, actualPipette: ?PipetteModelSpecs, displayName: string, - displayCategory: PipetteDisplayCategory, + displayCategory: ?PipetteDisplayCategory, direction: Direction, success: boolean, attachedWrong: boolean, @@ -38,4 +38,4 @@ export type ChangePipetteProps = { checkPipette: () => mixed, goToConfirmUrl: () => mixed, __pipettePlusEnabled: boolean, -} +|} diff --git a/app/src/components/ConnectPanel/RobotItem.js b/app/src/components/ConnectPanel/RobotItem.js index 6d1efd4f919..eaf816cf927 100644 --- a/app/src/components/ConnectPanel/RobotItem.js +++ b/app/src/components/ConnectPanel/RobotItem.js @@ -1,7 +1,7 @@ // @flow // item in a RobotList import { connect } from 'react-redux' -import { withRouter, type ContextRouter } from 'react-router' +import { withRouter, type ContextRouter } from 'react-router-dom' import { actions as robotActions } from '../../robot' import { getBuildrootUpdateAvailable } from '../../shell' @@ -10,9 +10,7 @@ import { RobotListItem } from './RobotListItem.js' import type { State, Dispatch } from '../../types' import type { ViewableRobot } from '../../discovery' -type WithRouterOP = {| robot: ViewableRobot |} - -type OP = {| ...ContextRouter, ...WithRouterOP |} +type OP = {| ...ContextRouter, robot: ViewableRobot |} type SP = {| upgradable: boolean, selected: boolean |} @@ -20,7 +18,7 @@ type DP = {| connect: () => mixed, disconnect: () => mixed |} export type RobotItemProps = { ...OP, ...SP, ...DP } -export default withRouter( +export default withRouter<_, _>( connect( mapStateToProps, mapDispatchToProps diff --git a/app/src/components/DeckMap/index.js b/app/src/components/DeckMap/index.js index 167df44610e..e9ae1ba3d9b 100644 --- a/app/src/components/DeckMap/index.js +++ b/app/src/components/DeckMap/index.js @@ -1,12 +1,12 @@ // @flow import React, { useMemo, type ElementProps } from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import some from 'lodash/some' import map from 'lodash/map' import mapValues from 'lodash/mapValues' import { type DeckSlotId } from '@opentrons/shared-data' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import { RobotWorkSpace, Module as ModuleItem } from '@opentrons/components' import { getDeckDefinitions } from '@opentrons/components/src/deck/getDeckDefinitions' @@ -25,17 +25,13 @@ import LabwareItem from './LabwareItem' export { LabwareItem } export type { LabwareItemProps } from './LabwareItem' -type WithRouterOP = {| +type OP = {| + ...ContextRouter, modulesRequired?: boolean, enableLabwareSelection?: boolean, className?: string, |} -type OP = {| - ...ContextRouter, - ...WithRouterOP, -|} - type DP = {| dispatch: Dispatch |} type DisplayModule = {| ...$Exact, @@ -169,6 +165,6 @@ function mapStateToProps(state: State, ownProps: OP): SP { } } -export default withRouter( +export default withRouter<_, _>( connect(mapStateToProps)(DeckMap) ) diff --git a/app/src/components/LostConnectionAlert/ModalCopy.js b/app/src/components/LostConnectionAlert/ModalCopy.js index e32aacb2950..4519afb6a69 100644 --- a/app/src/components/LostConnectionAlert/ModalCopy.js +++ b/app/src/components/LostConnectionAlert/ModalCopy.js @@ -1,6 +1,6 @@ // @flow import * as React from 'react' -import { Switch, Route } from 'react-router' +import { Switch, Route } from 'react-router-dom' import styles from './styles.css' diff --git a/app/src/components/LostConnectionAlert/index.js b/app/src/components/LostConnectionAlert/index.js index dbfb16760b1..c4ee67339b3 100644 --- a/app/src/components/LostConnectionAlert/index.js +++ b/app/src/components/LostConnectionAlert/index.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import { push } from 'connected-react-router' import find from 'lodash/find' @@ -14,15 +14,16 @@ import { AlertModal } from '@opentrons/components' import { Portal } from '../portal' import ModalCopy from './ModalCopy' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { State, Dispatch } from '../../types' +type OP = ContextRouter type SP = {| ok: ?boolean |} type DP = {| disconnect: () => mixed |} -type Props = { ...SP, ...DP } +type Props = {| ...OP, ...SP, ...DP |} -export default withRouter<{||}>( - connect( +export default withRouter<_, _>( + connect( mapStateToProps, mapDispatchToProps )(LostConnectionAlert) diff --git a/app/src/components/nav-bar/NavButton.js b/app/src/components/nav-bar/NavButton.js index c3fa6f0ccf9..a3af9078206 100644 --- a/app/src/components/nav-bar/NavButton.js +++ b/app/src/components/nav-bar/NavButton.js @@ -2,7 +2,7 @@ // nav button container import * as React from 'react' import { connect } from 'react-redux' -import { withRouter } from 'react-router' +import { withRouter } from 'react-router-dom' import { selectors as robotSelectors } from '../../robot' @@ -13,16 +13,14 @@ import { import { getConnectedRobot } from '../../discovery' import { NavButton } from '@opentrons/components' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { State } from '../../types' -type WithRouterOP = {| name: string |} - -type OP = {| ...ContextRouter, ...WithRouterOP |} +type OP = {| ...ContextRouter, name: string |} type Props = React.ElementProps -export default withRouter( +export default withRouter<_, _>( connect(mapStateToProps)(NavButton) ) diff --git a/app/src/pages/Calibrate/Labware.js b/app/src/pages/Calibrate/Labware.js index ec9243bb61d..258c4a771ca 100644 --- a/app/src/pages/Calibrate/Labware.js +++ b/app/src/pages/Calibrate/Labware.js @@ -2,7 +2,7 @@ // setup labware page import * as React from 'react' import { connect } from 'react-redux' -import { Route, Redirect, withRouter } from 'react-router' +import { Route, Redirect, withRouter } from 'react-router-dom' import { push } from 'connected-react-router' import { selectors as robotSelectors } from '../../robot' @@ -18,7 +18,7 @@ import ConfirmModal from '../../components/CalibrateLabware/ConfirmModal' import ConnectModules from '../../components/ConnectModules' import PrepareModules from '../../components/PrepareModules' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { State, Dispatch } from '../../types' import type { Labware } from '../../robot' import type { Robot } from '../../discovery' @@ -36,9 +36,9 @@ type SP = {| type DP = {| onBackClick: () => mixed |} -type Props = { ...OP, ...SP, ...DP } +type Props = {| ...OP, ...SP, ...DP |} -export default withRouter<{||}>( +export default withRouter<_, _>( connect( mapStateToProps, mapDispatchToProps diff --git a/app/src/pages/Calibrate/Pipettes.js b/app/src/pages/Calibrate/Pipettes.js index e08103e44f7..65ecf426a23 100644 --- a/app/src/pages/Calibrate/Pipettes.js +++ b/app/src/pages/Calibrate/Pipettes.js @@ -2,7 +2,7 @@ // setup pipettes component import * as React from 'react' import { connect } from 'react-redux' -import { Redirect } from 'react-router' +import { Redirect } from 'react-router-dom' import { selectors as robotSelectors } from '../../robot' import { getPipettesState, fetchPipettes } from '../../robot-api' @@ -13,7 +13,7 @@ import TipProbe from '../../components/TipProbe' import { PipetteTabs, Pipettes } from '../../components/calibrate-pipettes' import SessionHeader from '../../components/SessionHeader' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { State, Dispatch } from '../../types' import type { Pipette, TiprackByMountMap } from '../../robot' import type { PipettesState } from '../../robot-api' diff --git a/app/src/pages/Calibrate/index.js b/app/src/pages/Calibrate/index.js index 61a070ac6ea..a015a8d3f61 100644 --- a/app/src/pages/Calibrate/index.js +++ b/app/src/pages/Calibrate/index.js @@ -2,7 +2,7 @@ // calibrate page routes import * as React from 'react' import { connect } from 'react-redux' -import { Switch, Route, Redirect, type Match } from 'react-router' +import { Switch, Route, Redirect, type Match } from 'react-router-dom' import type { State } from '../../types' import type { Pipette, Labware } from '../../robot' diff --git a/app/src/pages/More/AppSettings.js b/app/src/pages/More/AppSettings.js index e4084cdf9ce..a1038d43b65 100644 --- a/app/src/pages/More/AppSettings.js +++ b/app/src/pages/More/AppSettings.js @@ -2,7 +2,7 @@ // view info about the app and update import * as React from 'react' import { connect } from 'react-redux' -import { Route, Switch, Redirect, type ContextRouter } from 'react-router' +import { Route, Switch, Redirect, type ContextRouter } from 'react-router-dom' import { push } from 'connected-react-router' import { diff --git a/app/src/pages/More/index.js b/app/src/pages/More/index.js index 01639a6601c..60d61abb86b 100644 --- a/app/src/pages/More/index.js +++ b/app/src/pages/More/index.js @@ -1,7 +1,7 @@ // @flow // more nav button routes import * as React from 'react' -import { Switch, Route, Redirect, type Match } from 'react-router' +import { Switch, Route, Redirect, type Match } from 'react-router-dom' import AppSettings from './AppSettings' import Resources from './Resources' diff --git a/app/src/pages/Robots/InstrumentSettings.js b/app/src/pages/Robots/InstrumentSettings.js index db2da33a25f..ab5c00395db 100644 --- a/app/src/pages/Robots/InstrumentSettings.js +++ b/app/src/pages/Robots/InstrumentSettings.js @@ -1,19 +1,19 @@ // @flow import * as React from 'react' -import { Switch, Route } from 'react-router' +import { Switch, Route } from 'react-router-dom' import InstrumentSettings from '../../components/InstrumentSettings' import ChangePipette from '../../components/ChangePipette' import ConfigurePipette from '../../components/ConfigurePipette' import Page from '../../components/Page' -import type { Match } from 'react-router' +import type { Match } from 'react-router-dom' import type { Robot } from '../../discovery' -type Props = { +type Props = {| robot: Robot, match: Match, -} +|} // used to guarantee mount param in route is left or right const RE_MOUNT = '(left|right)' diff --git a/app/src/pages/Robots/RobotSettings.js b/app/src/pages/Robots/RobotSettings.js index 17f1bbf8a5c..eb0d87d59af 100644 --- a/app/src/pages/Robots/RobotSettings.js +++ b/app/src/pages/Robots/RobotSettings.js @@ -2,7 +2,7 @@ // connect and configure robots page import * as React from 'react' import { connect } from 'react-redux' -import { withRouter, Route, Switch, Redirect } from 'react-router' +import { withRouter, Route, Switch, Redirect } from 'react-router-dom' import { selectors as robotSelectors, @@ -30,19 +30,15 @@ import ConnectBanner from '../../components/RobotSettings/ConnectBanner' import ReachableRobotBanner from '../../components/RobotSettings/ReachableRobotBanner' import ResetRobotModal from '../../components/RobotSettings/ResetRobotModal' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' import type { State, Dispatch, Error } from '../../types' import type { ViewableRobot } from '../../discovery' import type { ShellUpdateState } from '../../shell' -type WithRouterOP = {| - robot: ViewableRobot, - appUpdate: ShellUpdateState, -|} - type OP = {| ...ContextRouter, - ...WithRouterOP, + robot: ViewableRobot, + appUpdate: ShellUpdateState, |} type SP = {| @@ -62,7 +58,7 @@ type Props = {| closeConnectAlert: () => mixed, |} -export default withRouter( +export default withRouter<_, _>( connect( makeMapStateToProps, null, diff --git a/app/src/pages/Robots/index.js b/app/src/pages/Robots/index.js index f387befb148..938b7deb16f 100644 --- a/app/src/pages/Robots/index.js +++ b/app/src/pages/Robots/index.js @@ -2,7 +2,7 @@ // connect and configure robots page import * as React from 'react' import { useSelector } from 'react-redux' -import { withRouter, Route, Switch, Redirect } from 'react-router' +import { withRouter, Route, Switch, Redirect } from 'react-router-dom' import createLogger from '../../logger' @@ -19,7 +19,7 @@ import Page from '../../components/Page' import RobotSettings from './RobotSettings' import InstrumentSettings from './InstrumentSettings' -import type { ContextRouter } from 'react-router' +import type { ContextRouter } from 'react-router-dom' type Props = {| ...ContextRouter |} @@ -63,7 +63,9 @@ export function Robots(props: Props) { {robot.status === CONNECTABLE && ( } + render={props => ( + + )} /> )} (Robots) +export default withRouter<_, _>(Robots) diff --git a/app/src/pages/Run.js b/app/src/pages/Run.js index 98840409be8..e77c730de32 100644 --- a/app/src/pages/Run.js +++ b/app/src/pages/Run.js @@ -1,7 +1,7 @@ // @flow // run task component import * as React from 'react' -import { Route } from 'react-router' +import { Route } from 'react-router-dom' import Page from '../components/Page' import SessionHeader from '../components/SessionHeader' import RunLog, { ConfirmCancelModal } from '../components/RunLog' diff --git a/app/src/pages/SidePanel.js b/app/src/pages/SidePanel.js index 186c73dc321..495f12ff510 100644 --- a/app/src/pages/SidePanel.js +++ b/app/src/pages/SidePanel.js @@ -1,7 +1,7 @@ // @flow // side nav panel container import React from 'react' -import { Switch, Route } from 'react-router' +import { Switch, Route } from 'react-router-dom' import ConnectPanel from '../components/ConnectPanel' import UploadPanel from '../components/UploadPanel' diff --git a/app/src/pages/Upload/index.js b/app/src/pages/Upload/index.js index 2858814f491..fd4251fd5d7 100644 --- a/app/src/pages/Upload/index.js +++ b/app/src/pages/Upload/index.js @@ -2,7 +2,7 @@ // upload progress container import * as React from 'react' import { connect } from 'react-redux' -import { withRouter, Route, Switch, Redirect } from 'react-router' +import { withRouter, Route, Switch, Redirect } from 'react-router-dom' import { selectors as robotSelectors } from '../../robot' import { getProtocolFilename } from '../../protocol' @@ -12,8 +12,8 @@ import { Splash } from '@opentrons/components' import Page from '../../components/Page' import FileInfo from './FileInfo' -import type { ContextRouter } from 'react-router' -import type { State } from '../../types' +import type { ContextRouter } from 'react-router-dom' +import type { State, Dispatch } from '../../types' import type { Robot } from '../../discovery' type OP = ContextRouter @@ -26,9 +26,9 @@ type SP = {| sessionLoaded: boolean, |} -type Props = { ...OP, ...SP } +type Props = {| ...OP, ...SP, dispatch: Dispatch |} -export default withRouter<{||}>( +export default withRouter<_, _>( connect(mapStateToProps)(UploadPage) ) diff --git a/components/package.json b/components/package.json index fe209bff6d3..84cf80c5e36 100644 --- a/components/package.json +++ b/components/package.json @@ -22,7 +22,7 @@ "classnames": "^2.2.5", "lodash": "^4.17.4", "react": "^16.8.6", - "react-router-dom": "^4.2.2" + "react-router-dom": "^5.0.1" }, "dependencies": { "react-popper": "^1.0.0", diff --git a/components/src/__tests__/lists.test.js b/components/src/__tests__/lists.test.js index 6ad33448d52..db20b4b50b4 100644 --- a/components/src/__tests__/lists.test.js +++ b/components/src/__tests__/lists.test.js @@ -1,6 +1,6 @@ // list and list item components tests import React from 'react' -import { MemoryRouter } from 'react-router' +import { MemoryRouter } from 'react-router-dom' import Renderer from 'react-test-renderer' import { SidePanelGroup, TitledList, ListItem, ListAlert } from '..' diff --git a/components/src/__tests__/structure.test.js b/components/src/__tests__/structure.test.js index 3d103ace3d7..815081ac61b 100644 --- a/components/src/__tests__/structure.test.js +++ b/components/src/__tests__/structure.test.js @@ -1,6 +1,6 @@ // structure components tests import React from 'react' -import { MemoryRouter } from 'react-router' +import { MemoryRouter } from 'react-router-dom' import Renderer from 'react-test-renderer' import { diff --git a/flow-typed/npm/react-router-dom_v4.x.x.js b/flow-typed/npm/react-router-dom_v5.x.x.js similarity index 94% rename from flow-typed/npm/react-router-dom_v4.x.x.js rename to flow-typed/npm/react-router-dom_v5.x.x.js index eb345e4c2b6..8d894c46d29 100644 --- a/flow-typed/npm/react-router-dom_v4.x.x.js +++ b/flow-typed/npm/react-router-dom_v5.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 0bc486c8fc04d0bb37efa138223e4f67 -// flow-typed version: c6154227d1/react-router-dom_v4.x.x/flow_>=v0.104.x +// flow-typed signature: 359ff33af7cf8ed32157f0421593c7bd +// flow-typed version: c6154227d1/react-router-dom_v5.x.x/flow_>=v0.104.x declare module "react-router-dom" { declare export var BrowserRouter: React$ComponentType<{| @@ -29,8 +29,8 @@ declare module "react-router-dom" { to: string | LocationShape, activeClassName?: string, className?: string, - activeStyle?: Object, - style?: Object, + activeStyle?: { +[string]: mixed, ... }, + style?: { +[string]: mixed, ... }, isActive?: (match: Match, location: Location) => boolean, children?: React$Node, exact?: boolean, @@ -178,5 +178,5 @@ declare module "react-router-dom" { parent?: Match ): null | Match; - declare export function generatePath(pattern?: string, params?: Object): string; + declare export function generatePath(pattern?: string, params?: { +[string]: mixed, ... }): string; } diff --git a/flow-typed/npm/react-router_v4.x.x.js b/flow-typed/npm/react-router_v4.x.x.js deleted file mode 100644 index f342dba72f6..00000000000 --- a/flow-typed/npm/react-router_v4.x.x.js +++ /dev/null @@ -1,141 +0,0 @@ -// flow-typed signature: 392b7ed1ca3c83fef4daf36fce467f6c -// flow-typed version: c6154227d1/react-router_v4.x.x/flow_>=v0.104.x - -declare module "react-router" { - // NOTE: many of these are re-exported by react-router-dom and - // react-router-native, so when making changes, please be sure to update those - // as well. - declare export type Location = { - pathname: string, - search: string, - hash: string, - state?: any, - key?: string, - ... - }; - - declare export type LocationShape = { - pathname?: string, - search?: string, - hash?: string, - state?: any, - ... - }; - - declare export type HistoryAction = "PUSH" | "REPLACE" | "POP"; - - declare export type RouterHistory = { - length: number, - location: Location, - action: HistoryAction, - listen( - callback: (location: Location, action: HistoryAction) => void - ): () => void, - push(path: string | LocationShape, state?: any): void, - replace(path: string | LocationShape, state?: any): void, - go(n: number): void, - goBack(): void, - goForward(): void, - canGo?: (n: number) => boolean, - block( - callback: string | (location: Location, action: HistoryAction) => ?string - ): () => void, - // createMemoryHistory - index?: number, - entries?: Array, - ... - }; - - declare export type Match = { - params: { [key: string]: ?string, ... }, - isExact: boolean, - path: string, - url: string, - ... - }; - - declare export type ContextRouter = {| - history: RouterHistory, - location: Location, - match: Match, - staticContext?: StaticRouterContext - |}; - - declare export type GetUserConfirmation = ( - message: string, - callback: (confirmed: boolean) => void - ) => void; - - declare type StaticRouterContext = { url?: string, ... }; - - declare export class StaticRouter extends React$Component<{ - basename?: string, - location?: string | Location, - context: StaticRouterContext, - children?: React$Node, - ... - }> {} - - declare export class MemoryRouter extends React$Component<{ - initialEntries?: Array, - initialIndex?: number, - getUserConfirmation?: GetUserConfirmation, - keyLength?: number, - children?: React$Node, - ... - }> {} - - declare export class Router extends React$Component<{ - history: RouterHistory, - children?: React$Node, - ... - }> {} - - declare export class Prompt extends React$Component<{ - message: string | ((location: Location) => string | true), - when?: boolean, - ... - }> {} - - declare export class Redirect extends React$Component<{| - to: string | LocationShape, - push?: boolean, - from?: string, - exact?: boolean, - strict?: boolean - |}> {} - - - declare export class Route extends React$Component<{| - component?: React$ComponentType<*>, - render?: (router: ContextRouter) => React$Node, - children?: React$ComponentType | React$Node, - path?: string, - exact?: boolean, - strict?: boolean, - location?: LocationShape, - sensitive?: boolean - |}> {} - - declare export class Switch extends React$Component<{| - children?: React$Node, - location?: Location - |}> {} - - declare export function withRouter

( - Component: React$ComponentType<{| ...ContextRouter, ...P |}> - ): React$ComponentType

; - - declare type MatchPathOptions = { - path?: string, - exact?: boolean, - strict?: boolean, - sensitive?: boolean, - ... - }; - - declare export function matchPath( - pathname: string, - options?: MatchPathOptions | string - ): null | Match; -} diff --git a/labware-library/package.json b/labware-library/package.json index 37923411708..19dc3076ddb 100644 --- a/labware-library/package.json +++ b/labware-library/package.json @@ -26,7 +26,7 @@ "react": "^16.8.6", "react-dom": "^16.8.6", "react-hot-loader": "^4.8.0", - "react-router-dom": "^5.0.0", + "react-router-dom": "^5.0.1", "yup": "^0.27.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index d237718d992..0e3db827416 100644 --- a/yarn.lock +++ b/yarn.lock @@ -773,6 +773,13 @@ dependencies: regenerator-runtime "^0.12.0" +"@babel/runtime@^7.4.0": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" + integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/runtime@^7.4.5": version "7.4.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12" @@ -4380,10 +4387,10 @@ connect-history-api-fallback@^1.3.0: version "1.5.0" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a" -connected-react-router@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/connected-react-router/-/connected-react-router-6.4.0.tgz#c382a9e70fdd1247c09c7ece7854622db4d46234" - integrity sha512-RZRLD7qUz9OdmCn0JkW7pOiUsR7v9NtqnYKfqrxXsfO2ozMLR2/MjHaSPpdbMr4VE5TY6MwzAXUSkheN2ldqug== +connected-react-router@^6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/connected-react-router/-/connected-react-router-6.5.2.tgz#422af70f86cb276681e20ab4295cf27dd9b6c7e3" + integrity sha512-qzsLPZCofSI80fwy+HgxtEgSGS4ndYUUZAWaw1dqaOGPLKX/FVwIOEb7q+hjHdnZ4v5pKZcNv5GG4urjujIoyA== dependencies: immutable "^3.8.1" prop-types "^15.7.2" @@ -7907,10 +7914,6 @@ hoek@4.x.x: version "4.2.0" resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" -hoist-non-react-statics@^2.3.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0" - hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.5: version "2.5.5" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" @@ -10629,6 +10632,15 @@ min-document@^2.19.0: dependencies: dom-walk "^0.1.0" +mini-create-react-context@^0.3.0: + version "0.3.2" + resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.3.2.tgz#79fc598f283dd623da8e088b05db8cddab250189" + integrity sha512-2v+OeetEyliMt5VHMXsBhABoJ0/M4RCe7fatd/fBy6SMiKazUSEt3gxxypfnk2SHMkdBYvorHRoQxuGoiwbzAw== + dependencies: + "@babel/runtime" "^7.4.0" + gud "^1.0.0" + tiny-warning "^1.0.2" + mini-css-extract-plugin@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.4.tgz#c10410a004951bd3cedac1da69053940fccb625d" @@ -13384,58 +13396,35 @@ react-remove-scroll@^1.0.8: react-remove-scroll-bar "^1.1.5" tslib "^1.0.0" -react-router-dom@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.2.2.tgz#c8a81df3adc58bba8a76782e946cbd4eae649b8d" - dependencies: - history "^4.7.2" - invariant "^2.2.2" - loose-envify "^1.3.1" - prop-types "^15.5.4" - react-router "^4.2.0" - warning "^3.0.0" - -react-router-dom@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.0.0.tgz#542a9b86af269a37f0b87218c4c25ea8dcf0c073" - integrity sha512-wSpja5g9kh5dIteZT3tUoggjnsa+TPFHSMrpHXMpFsaHhQkm/JNVGh2jiF9Dkh4+duj4MKCkwO6H08u6inZYgQ== +react-router-dom@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.0.1.tgz#ee66f4a5d18b6089c361958e443489d6bab714be" + integrity sha512-zaVHSy7NN0G91/Bz9GD4owex5+eop+KvgbxXsP/O+iW1/Ln+BrJ8QiIR5a6xNPtrdTvLkxqlDClx13QO1uB8CA== dependencies: "@babel/runtime" "^7.1.2" history "^4.9.0" loose-envify "^1.3.1" prop-types "^15.6.2" - react-router "5.0.0" + react-router "5.0.1" tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react-router@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.0.0.tgz#349863f769ffc2fa10ee7331a4296e86bc12879d" - integrity sha512-6EQDakGdLG/it2x9EaCt9ZpEEPxnd0OCLBHQ1AcITAAx7nCnyvnzf76jKWG1s2/oJ7SSviUgfWHofdYljFexsA== +react-router@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.0.1.tgz#04ee77df1d1ab6cb8939f9f01ad5702dbadb8b0f" + integrity sha512-EM7suCPNKb1NxcTZ2LEOWFtQBQRQXecLxVpdsP4DW4PbbqYWeRiLyV/Tt1SdCrvT2jcyXAXmVTmzvSzrPR63Bg== dependencies: "@babel/runtime" "^7.1.2" - create-react-context "^0.2.2" history "^4.9.0" hoist-non-react-statics "^3.1.0" loose-envify "^1.3.1" + mini-create-react-context "^0.3.0" path-to-regexp "^1.7.0" prop-types "^15.6.2" react-is "^16.6.0" tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react-router@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.2.0.tgz#61f7b3e3770daeb24062dae3eedef1b054155986" - dependencies: - history "^4.7.2" - hoist-non-react-statics "^2.3.0" - invariant "^2.2.2" - loose-envify "^1.3.1" - path-to-regexp "^1.7.0" - prop-types "^15.5.4" - warning "^3.0.0" - react-select@^2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/react-select/-/react-select-2.4.3.tgz#62efdf76d7e33e9bde22d907a0cc8abd0aeab656"