Skip to content

Commit

Permalink
[React] react-router v7
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Nov 25, 2024
1 parent 7c37c1f commit b543c75
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 13 deletions.
3 changes: 2 additions & 1 deletion generators/react/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-loadable": "5.5.0",
"react-redux": "9.1.2",
"react-redux-loading-bar": "5.0.8",
"react-router-dom": "6.28.0",
"react-router-dom": "7.0.1",
"react-toastify": "10.0.6",
"react-transition-group": "4.4.5",
"reactstrap": "9.2.3",
Expand Down Expand Up @@ -60,6 +60,7 @@
"identity-obj-proxy": "3.0.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-fixed-jsdom": "0.0.9",
"jest-junit": "16.0.0",
"jest-sonar": "0.2.16",
"json-loader": "0.5.7",
Expand Down
2 changes: 1 addition & 1 deletion generators/react/templates/jest.conf.js.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const tsconfig = require('./tsconfig.test.json');

module.exports = {
testEnvironment: 'jsdom',
testEnvironment: 'jest-fixed-jsdom',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
Expand Down
1 change: 1 addition & 0 deletions generators/react/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"identity-obj-proxy": "<%= nodeDependencies['identity-obj-proxy'] %>",
"jest": "<%= nodeDependencies['jest'] %>",
"jest-environment-jsdom": "<%= nodeDependencies['jest-environment-jsdom'] %>",
"jest-fixed-jsdom": "<%= nodeDependencies['jest-fixed-jsdom'] %>",
"jest-junit": "<%= nodeDependencies['jest-junit'] %>",
"jest-sonar": "<%= nodeDependencies['jest-sonar'] %>",
"json-loader": "<%= nodeDependencies['json-loader'] %>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
import React from 'react';
import { Route } from 'react-router-dom';
import { Route } from 'react-router';

import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
import React from 'react';
import { Route } from 'react-router-dom';
import { Route } from 'react-router';

import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
import React from 'react';
import { Route } from 'react-router-dom';
import { Route } from 'react-router';

import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-%>
import React from 'react';

import { Route } from 'react-router-dom';
import { Route } from 'react-router';
import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes';
<%_ if (generateUserManagement) { _%>
import UserManagement from './user-management';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
limitations under the License.
-%>
import React from 'react';
import { Route } from 'react-router-dom';
import { Route } from 'react-router';

import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes';
import UserManagement from './user-management';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
limitations under the License.
-%>
import React<% if (applicationTypeGateway && microfrontend) { %>, { Suspense }<% } %> from 'react';
import { Route <% if (communicationSpringWebsocket) { %>, useLocation <% } %>} from 'react-router-dom';
import { Route } from 'react-router';
<% if (communicationSpringWebsocket) { %>
import { useLocation } from 'react-router-dom';
<% } %>
import Loadable from 'react-loadable';
<%_ if (applicationTypeGateway && microfrontend) { _%>
import { importRemote } from '@module-federation/utilities';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { MemoryRouter, Route, Routes } from 'react-router';
import { render } from '@testing-library/react';
<%_ if (enableTranslation) { _%>
import { TranslatorContext } from 'react-jhipster';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { MemoryRouter, Route } from 'react-router-dom';
import { MemoryRouter, Route } from 'react-router';
import { render } from '@testing-library/react';

import ErrorBoundaryRoutes from './error-boundary-routes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Outlet, Route, Routes, RoutesProps } from 'react-router-dom';
import { Routes, Route } from 'react-router';
import { Outlet, RoutesProps } from 'react-router-dom';
import ErrorBoundary from 'app/shared/error/error-boundary';

const ErrorBoundaryRoutes = ({ children }: RoutesProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router-dom';
import { MemoryRouter } from 'react-router';

import initStore from 'app/config/store';
import Header from './header';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-%>
import React from 'react';
import { render } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { MemoryRouter } from 'react-router';


<%_ if (authenticationTypeOauth2) { _%>
Expand Down

0 comments on commit b543c75

Please sign in to comment.