Skip to content

Commit c10029b

Browse files
authored
Update to React 19 (#4241)
1 parent 18d7e9b commit c10029b

53 files changed

Lines changed: 743 additions & 614 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Plan/common/src/test/java/com/djrapitops/plan/delivery/export/ExportTestUtilities.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ public static void assertNoLogs(List<LogEntry> logs, String endpoint) {
7070

7171
private static boolean ignoredLogLines(String log) {
7272
return !StringUtils.containsAny(log,
73-
"fonts.gstatic.com", "fonts.googleapis.com", "cdn.jsdelivr.net", "manifest.json",
74-
"React Router Future Flag Warning", // TODO remove after update to react-router-dom v7
75-
"Highcharts warning:" // TODO remove after fixing highcharts module loading issues
73+
"fonts.gstatic.com", "fonts.googleapis.com", "cdn.jsdelivr.net", "manifest.json"
7674
);
7775
}
7876

Plan/react/dashboard/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,19 @@
3333
"i18next-localstorage-backend": "^4.2.0",
3434
"masonry-layout": "^4.2.2",
3535
"moment": "^2.30.1",
36-
"react": "^18.3.1",
36+
"react": "^19.1.1",
3737
"react-bootstrap": "^2.10.10",
3838
"react-bootstrap-range-slider": "^3.0.8",
39-
"react-dom": "^18.3.1",
39+
"react-dom": "^19.1.1",
4040
"react-i18next": "^15.7.1",
4141
"react-mcjsonchat": "^1.0.0",
42-
"react-router-dom": "^6.26.0",
42+
"react-router": "^7.8.2",
4343
"react-select": "^5.10.2",
44+
"react-transition-group": "^4.4.5",
4445
"sass": "^1.90.0",
4546
"source-map-explorer": "^2.5.2",
4647
"swagger-ui": "^5.27.1",
47-
"web-vitals": "^4.2.4"
48+
"web-vitals": "^5.1.0"
4849
},
4950
"scripts": {
5051
"start": "vite",

Plan/react/dashboard/src/App.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import './style/style.css';
55
import './style/mobile.css';
66
import 'react-bootstrap-range-slider/dist/react-bootstrap-range-slider.css';
77

8-
import {createBrowserRouter, createRoutesFromElements, Navigate, Route, RouterProvider} from "react-router-dom";
8+
import {createBrowserRouter, createRoutesFromElements, Navigate, Route, RouterProvider} from "react-router";
99
import React, {useCallback, useEffect} from "react";
1010
import {ThemeContextProvider, useTheme} from "./hooks/themeHook";
1111
import axios from "axios";
@@ -134,18 +134,16 @@ const getBasename = () => {
134134
const router = createBrowserRouter(
135135
createRoutesFromElements(
136136
<>
137-
<Route path="" element={<MainPageRedirect/>}/>
138-
<Route path="/" element={<MainPageRedirect/>}/>
139137
<Route path="index.html" element={<MainPageRedirect/>}/>
140138
{!staticSite && <Route path="/login" element={<Lazy><LoginPage/></Lazy>}/>}
141139
{!staticSite && <Route path="/register" element={<Lazy><RegisterPage/></Lazy>}/>}
142140
<Route path="/player/:identifier" element={<Lazy><PlayerPage/></Lazy>}>
143-
<Route path="" element={<Lazy><OverviewRedirect/></Lazy>}/>
144141
<Route path="overview" element={<Lazy><PlayerOverview/></Lazy>}/>
145142
<Route path="sessions" element={<Lazy><PlayerSessions/></Lazy>}/>
146143
<Route path="pvppve" element={<Lazy><PlayerPvpPve/></Lazy>}/>
147144
<Route path="servers" element={<Lazy><PlayerServers/></Lazy>}/>
148145
<Route path="plugins/:serverName" element={<Lazy><PlayerPluginData/></Lazy>}/>
146+
<Route path="" element={<Lazy><OverviewRedirect/></Lazy>}/>
149147
<Route path="*" element={<ErrorView error={{
150148
message: 'Unknown tab address, please correct the address',
151149
title: 'No such tab',
@@ -157,7 +155,6 @@ const router = createBrowserRouter(
157155
<Route path="*" element={<Lazy><AllPlayers/></Lazy>}/>
158156
</Route>
159157
<Route path="/server/:identifier" element={<Lazy><ServerPage/></Lazy>}>
160-
<Route path="" element={<OverviewRedirect/>}/>
161158
<Route path="overview" element={<Lazy><ServerOverview/></Lazy>}/>
162159
<Route path="online-activity" element={<Lazy><OnlineActivity/></Lazy>}/>
163160
<Route path="sessions" element={<Lazy><ServerSessions/></Lazy>}/>
@@ -172,14 +169,14 @@ const router = createBrowserRouter(
172169
<Route path="plugin-history" element={<Lazy><ServerPluginHistory/></Lazy>}/>
173170
<Route path="plugins-overview" element={<Lazy><ServerPluginData/></Lazy>}/>
174171
<Route path="plugins/:plugin" element={<Lazy><ServerWidePluginData/></Lazy>}/>
172+
<Route path="" element={<OverviewRedirect/>}/>
175173
<Route path="*" element={<ErrorView error={{
176174
message: 'Unknown tab address, please correct the address',
177175
title: 'No such tab',
178176
icon: faMapSigns
179177
}}/>}/>
180178
</Route>
181179
<Route path="/network" element={<Lazy><NetworkPage/></Lazy>}>
182-
<Route path="" element={<OverviewRedirect/>}/>
183180
<Route path="overview" element={<Lazy><NetworkOverview/></Lazy>}/>
184181
<Route path="serversOverview" element={<Lazy><NetworkServers/></Lazy>}/>
185182
<Route path="sessions" element={<Lazy><NetworkSessions/></Lazy>}/>
@@ -193,6 +190,7 @@ const router = createBrowserRouter(
193190
<Route path="plugin-history" element={<Lazy><NetworkPluginHistory/></Lazy>}/>
194191
<Route path="plugins-overview" element={<Lazy><ServerPluginData/></Lazy>}/>
195192
<Route path="plugins/:plugin" element={<Lazy><ServerWidePluginData/></Lazy>}/>
193+
<Route path="" element={<OverviewRedirect/>}/>
196194
<Route path="*" element={<ErrorView error={{
197195
message: 'Unknown tab address, please correct the address',
198196
title: 'No such tab',
@@ -204,19 +202,21 @@ const router = createBrowserRouter(
204202
<Route path="groups" element={<Lazy><GroupsView/></Lazy>}/>
205203
</Route>}
206204
{!staticSite && <Route path="/query" element={<Lazy><QueryPage/></Lazy>}>
207-
<Route path="" element={<NewRedirect/>}/>
208205
<Route path="new" element={<Lazy><NewQueryView/></Lazy>}/>
209206
<Route path="result" element={<Lazy><QueryResultView/></Lazy>}/>
207+
<Route path="" element={<NewRedirect/>}/>
210208
</Route>}
211209
{!staticSite && <Route path="/errors" element={<Lazy><ErrorsPage/></Lazy>}/>}
212210
{!staticSite && <Route path="/docs" element={<Lazy><SwaggerView/></Lazy>}/>}
213211
<Route path="/theme-editor" element={<Lazy><ThemeEditorPage/></Lazy>
214212
}>
215-
<Route path="" element={<NewRedirect/>}/>
216213
<Route path=":identifier" element={<Lazy><ThemeEditorView/></Lazy>}/>
217214
<Route path="new" element={<Lazy><AddThemeView/></Lazy>}/>
218215
<Route path="delete" element={<Lazy><DeleteThemesView/></Lazy>}/>
216+
<Route path="" element={<NewRedirect/>}/>
219217
</Route>
218+
<Route path="" element={<MainPageRedirect/>}/>
219+
<Route path="/" element={<MainPageRedirect/>}/>
220220
<Route path="*" element={<Lazy><ErrorPage error={{
221221
message: 'Page not found, please correct the address',
222222
title: 'No such page',

Plan/react/dashboard/src/components/CardTabs.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useEffect, useState} from "react";
2-
import {useLocation, useNavigate} from "react-router-dom";
2+
import {useLocation, useNavigate} from "react-router";
33
import {FontAwesomeIcon as Fa} from "@fortawesome/react-fontawesome";
44

55
const TabButton = ({id, name, href, icon, color, active, disabled}) => {

Plan/react/dashboard/src/components/alert/QueryPath.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {useQueryResultContext} from "../../hooks/queryResultContext";
33
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
44
import {faFilter} from "@fortawesome/free-solid-svg-icons";
55
import {useTranslation} from "react-i18next";
6-
import {Link} from "react-router-dom";
6+
import {Link} from "react-router";
77

88
const QueryPath = ({newQuery}) => {
99
const {t} = useTranslation();

Plan/react/dashboard/src/components/animation/LoadIn.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import React, {useEffect, useState} from 'react';
1+
import React, {useEffect, useRef, useState} from 'react';
22
import {Transition} from 'react-transition-group';
33

44
const defaultDuration = 250;
55

66
const LoadIn = ({children, duration}) => {
7+
const nodeRef = useRef();
8+
79
if (!duration) duration = defaultDuration;
810
const reduceAnimations = window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;
911

@@ -58,9 +60,9 @@ const LoadIn = ({children, duration}) => {
5860
}, [setVisible])
5961

6062
return (
61-
<Transition in={visible} timeout={duration}>
63+
<Transition in={visible} timeout={duration} nodeRef={nodeRef}>
6264
{state => (
63-
<div className={"load-in"} style={{
65+
<div ref={nodeRef} className={"load-in"} style={{
6466
...defaultStyle,
6567
...transitionStyles[state]
6668
}}>

Plan/react/dashboard/src/components/cards/query/QueryOptionsCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import CollapseWithButton from "../../layout/CollapseWithButton";
1818
import FilterDropdown from "./FilterDropdown";
1919
import FilterList from "./FilterList";
2020
import {useQueryResultContext} from "../../../hooks/queryResultContext";
21-
import {useNavigate} from "react-router-dom";
21+
import {useNavigate} from "react-router";
2222
import {useNavigation} from "../../../hooks/navigationHook.jsx";
2323
import ActionButton from "../../input/button/ActionButton.jsx";
2424

Plan/react/dashboard/src/components/cards/server/graphs/OnlineActivityCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {useTranslation} from "react-i18next";
2-
import {useParams} from "react-router-dom";
2+
import {useParams} from "react-router";
33
import {useDataRequest} from "../../../../hooks/dataFetchHook";
44
import {fetchPlayersOnlineGraph} from "../../../../service/serverService";
55
import {ErrorViewCard} from "../../../../views/ErrorView";

Plan/react/dashboard/src/components/cards/server/graphs/OnlineActivityGraphsCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useParams} from "react-router-dom";
1+
import {useParams} from "react-router";
22
import {useDataRequest} from "../../../../hooks/dataFetchHook";
33
import {
44
fetchDayByDayGraph,

Plan/react/dashboard/src/components/cards/server/graphs/PerformanceGraphsCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useParams} from "react-router-dom";
1+
import {useParams} from "react-router";
22
import {useDataRequest} from "../../../../hooks/dataFetchHook";
33
import {fetchOptimizedPerformance, fetchPingGraph, fetchPluginHistory} from "../../../../service/serverService";
44
import {ErrorViewBody} from "../../../../views/ErrorView";

0 commit comments

Comments
 (0)