Skip to content

Commit f3094e7

Browse files
committed
[grid] Upgrading to react-router-dom v6
1 parent b4c8d63 commit f3094e7

File tree

8 files changed

+89
-351
lines changed

8 files changed

+89
-351
lines changed

‎java/src/org/openqa/selenium/grid/web/GridUiRoute.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public GridUiRoute() {
4444
ResourceHandler uiHandler = new ResourceHandler(new ClassPathResource(uiRoot, GRID_RESOURCE));
4545
HttpResponse uiRedirect = new HttpResponse()
4646
.setStatus(HTTP_MOVED_TEMP)
47-
.addHeader("Location", "/ui/index.html");
47+
.addHeader("Location", "/ui");
4848
routes = Route.combine(
4949
get("/").to(() -> req -> uiRedirect),
5050
get("/grid/console").to(() -> req -> uiRedirect),

‎javascript/grid-ui/package-lock.json

Lines changed: 30 additions & 157 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎javascript/grid-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"react": "^17.0.1",
1919
"react-dom": "^17.0.1",
2020
"react-modal": "^3.14.3",
21-
"react-router-dom": "^5.3.0",
21+
"react-router-dom": "^6.3.0",
2222
"source-map-explorer": "^2.5.2"
2323
},
2424
"scripts": {

‎javascript/grid-ui/src/App.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
InMemoryCache,
2222
NormalizedCacheObject
2323
} from '@apollo/client'
24-
import { Route, Switch } from 'react-router-dom'
24+
import { Route, Routes } from 'react-router-dom'
2525
import React, { ReactNode } from 'react'
2626
import ReactModal from 'react-modal'
2727
import { GridConfig } from './config'
@@ -154,22 +154,14 @@ class App extends React.Component<AppProps, AppState> {
154154
)}
155155
<main className={classes.content}>
156156
<Container maxWidth={false} className={classes.container}>
157-
<Switch>
158-
<Route exact path="/sessions">
159-
<Sessions {...this.props}/>
160-
</Route>
161-
<Route exact path="/help">
162-
<Help {...this.props}/>
163-
</Route>
164-
<Route exact path="/">
165-
<Overview {...this.props}/>
166-
</Route>
167-
<Route>
168-
<Help {...this.props}/>
169-
</Route>
170-
</Switch>
157+
<Routes>
158+
<Route path="/sessions" element={<Sessions {...this.props}/>}/>
159+
<Route path="/help" element={<Help {...this.props}/>}/>
160+
<Route path="/" element={<Overview {...this.props}/>}/>
161+
<Route path="*" element={<Help {...this.props}/>}/>
162+
</Routes>
171163
</Container>
172-
<Footer />
164+
<Footer/>
173165
</main>
174166
</div>
175167
</ApolloProvider>

0 commit comments

Comments
 (0)