Skip to content

Commit

Permalink
housekeeping: Updating react-router & react-router-dom to 6.0.0 (#3150)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdslaugh authored Nov 5, 2024
1 parent 8471558 commit f646ee2
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 52 deletions.
1 change: 1 addition & 0 deletions frontend/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"main": "src/index.js",
"types": "src/index.d.ts",
"scripts": {
"clean": "yarn run package:clean",
"publishBeta": "../../tools/publish-frontend.sh api"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
"jest": "27.5.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-router": "6.0.0",
"react-router-dom": "6.0.0",
"recharts": "2.1.9",
"typescript": "4.2.3"
},
Expand Down
36 changes: 23 additions & 13 deletions frontend/packages/app/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
module.exports = function override(config) {
const loaders = config.module.rules.find(rule => rule.oneOf).oneOf;
loaders.splice(2, 0, {
test: /\.(js|mjs|jsx|ts|tsx)$/,
exclude: /.*node_modules.*/,
use: [
{
loader: "esbuild-loader",
options: {
loader: "jsx",
target: "esnext",
loaders.splice(
2,
0,
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
exclude: /.*node_modules.*/,
use: [
{
loader: "esbuild-loader",
options: {
loader: "jsx",
target: "esnext",
},
},
},
],
});
return config;
],
},
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
}
);

return { ...config, ignoreWarnings: [/Failed to parse source map/] };
};
3 changes: 1 addition & 2 deletions frontend/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"material-table": "^2.0.3",
"react-hook-form": "^7.25.3",
"react-is": "^17.0.2",
"react-router": "^6.0.0-beta.0",
"react-router-dom": "^6.0.0-beta.0",
"react-router-dom": "6.0.0",
"react-test-renderer": "^17.0.2",
"react-timeago": "^7.0.0",
"recharts": "^2.1.9",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { MemoryRouter } from "react-router";
import { MemoryRouter } from "react-router-dom";
import { Grid } from "@mui/material";
import type { Meta } from "@storybook/react";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { MemoryRouter } from "react-router";
import { MemoryRouter } from "react-router-dom";
import type { Meta, StoryObj } from "@storybook/react";

import { ApplicationContext, UserPreferencesProvider } from "../../Contexts";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { MemoryRouter } from "react-router";
import { MemoryRouter } from "react-router-dom";
import styled from "@emotion/styled";
import { Box, Grid as MuiGrid, Theme } from "@mui/material";
import type { Meta } from "@storybook/react";
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/src/NPS/stories/banner.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { MemoryRouter } from "react-router";
import { MemoryRouter } from "react-router-dom";
import type { Meta } from "@storybook/react";

import { Header } from "../../AppLayout/header";
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/src/NPS/stories/header.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { MemoryRouter } from "react-router";
import { MemoryRouter } from "react-router-dom";
import type { Meta } from "@storybook/react";

import { Header } from "../../AppLayout/header";
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/src/WorkflowLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { matchPath } from "react-router";
import { matchPath } from "react-router-dom";
import type { Interpolation } from "@emotion/styled";
import type { CSSObject, Theme } from "@mui/material";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Location } from "history";
import type { Location } from "react-router-dom";

import type { BreadcrumbEntry } from "../Breadcrumbs";

Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/src/utils/pathMatching.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { matchPath } from "react-router";
import { matchPath } from "react-router-dom";

const findPathMatchList = (locationPathname: string, pathsToMatch: string[]) => {
const pathFound = pathsToMatch?.find((path: string) => matchPath({ path }, locationPathname));
Expand Down
4 changes: 2 additions & 2 deletions frontend/packages/tools/yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const enforcedPackages = {
"@types/react-dom": "^17.0.3",
"@types/react": "^17.0.5",
"react-dom": "^17.0.2",
"react-router-dom": "^6.0.0-beta.0",
"react-router": "^6.0.0-beta.0",
"react-router-dom": "6.0.0",
"react-router": "6.0.0",
esbuild: "^0.18.0",
eslint: "^8.3.0",
jest: "^27.0.0",
Expand Down
1 change: 0 additions & 1 deletion frontend/workflows/projectCatalog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@mui/material": "^5.11.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "6.0.0-beta.0",
"typescript": "^4.2.3"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const CatalogLayout = ({
allowDisabled,
quickLinkSettings = true,
}: CatalogLayoutProps) => {
const { projectId } = useParams();
const { projectId = "" } = useParams();
const navigate = useNavigate();
const [projectInfo, setProjectInfo] = React.useState<IClutch.core.project.v1.IProject | null>(
null
Expand All @@ -56,12 +56,16 @@ const CatalogLayout = ({
});

React.useEffect(() => {
fetchData();
if (projectId) {
fetchData();

const interval = setInterval(fetchData, 30000);
const interval = setInterval(fetchData, 30000);

return () => (interval ? clearInterval(interval) : undefined);
}, []);
return () => (interval ? clearInterval(interval) : undefined);
}

return () => {};
}, [projectId]);

return (
<ProjectDetailsContext.Provider value={projInfo}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import { useParams } from "react-router-dom";
import {
checkFeatureEnabled,
Grid,
Expand All @@ -11,6 +10,7 @@ import {
QuickLinksCard,
styled,
Typography,
useParams,
} from "@clutch-sh/core";
import SettingsIcon from "@mui/icons-material/Settings";
import { isEmpty } from "lodash";
Expand Down
36 changes: 20 additions & 16 deletions frontend/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "7.25.3",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-router": "6.0.0",
"react-router-dom": "6.0.0",
"typescript": "4.2.3"
},
"devDependencies": {
Expand Down

0 comments on commit f646ee2

Please sign in to comment.