diff --git a/frontend/api/package.json b/frontend/api/package.json index 9bc9a433a0..077fc82278 100644 --- a/frontend/api/package.json +++ b/frontend/api/package.json @@ -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": { diff --git a/frontend/package.json b/frontend/package.json index ac93445131..2f4a13f941 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -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" }, diff --git a/frontend/packages/app/config-overrides.js b/frontend/packages/app/config-overrides.js index 1204016084..6d66499cde 100644 --- a/frontend/packages/app/config-overrides.js +++ b/frontend/packages/app/config-overrides.js @@ -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/] }; }; diff --git a/frontend/packages/core/package.json b/frontend/packages/core/package.json index 6feaacf75d..daa90265ca 100644 --- a/frontend/packages/core/package.json +++ b/frontend/packages/core/package.json @@ -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", diff --git a/frontend/packages/core/src/AppLayout/stories/drawer.stories.tsx b/frontend/packages/core/src/AppLayout/stories/drawer.stories.tsx index 26a9a2f54e..f740691cc9 100644 --- a/frontend/packages/core/src/AppLayout/stories/drawer.stories.tsx +++ b/frontend/packages/core/src/AppLayout/stories/drawer.stories.tsx @@ -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"; diff --git a/frontend/packages/core/src/AppLayout/stories/header.stories.tsx b/frontend/packages/core/src/AppLayout/stories/header.stories.tsx index 032a82fc78..ab7230e1de 100644 --- a/frontend/packages/core/src/AppLayout/stories/header.stories.tsx +++ b/frontend/packages/core/src/AppLayout/stories/header.stories.tsx @@ -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"; diff --git a/frontend/packages/core/src/AppLayout/stories/searchfield.stories.tsx b/frontend/packages/core/src/AppLayout/stories/searchfield.stories.tsx index c378d880b5..9e1151c209 100644 --- a/frontend/packages/core/src/AppLayout/stories/searchfield.stories.tsx +++ b/frontend/packages/core/src/AppLayout/stories/searchfield.stories.tsx @@ -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"; diff --git a/frontend/packages/core/src/NPS/stories/banner.stories.tsx b/frontend/packages/core/src/NPS/stories/banner.stories.tsx index 1213126d8b..a7d1d56c7e 100644 --- a/frontend/packages/core/src/NPS/stories/banner.stories.tsx +++ b/frontend/packages/core/src/NPS/stories/banner.stories.tsx @@ -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"; diff --git a/frontend/packages/core/src/NPS/stories/header.stories.tsx b/frontend/packages/core/src/NPS/stories/header.stories.tsx index 5bc644848a..425f2ebe02 100644 --- a/frontend/packages/core/src/NPS/stories/header.stories.tsx +++ b/frontend/packages/core/src/NPS/stories/header.stories.tsx @@ -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"; diff --git a/frontend/packages/core/src/WorkflowLayout/index.tsx b/frontend/packages/core/src/WorkflowLayout/index.tsx index bdfcd5fff9..5c2df0c6cc 100644 --- a/frontend/packages/core/src/WorkflowLayout/index.tsx +++ b/frontend/packages/core/src/WorkflowLayout/index.tsx @@ -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"; diff --git a/frontend/packages/core/src/utils/generateBreadcrumbsEntries.tsx b/frontend/packages/core/src/utils/generateBreadcrumbsEntries.tsx index 029deed285..964671c64f 100644 --- a/frontend/packages/core/src/utils/generateBreadcrumbsEntries.tsx +++ b/frontend/packages/core/src/utils/generateBreadcrumbsEntries.tsx @@ -1,4 +1,4 @@ -import type { Location } from "history"; +import type { Location } from "react-router-dom"; import type { BreadcrumbEntry } from "../Breadcrumbs"; diff --git a/frontend/packages/core/src/utils/pathMatching.tsx b/frontend/packages/core/src/utils/pathMatching.tsx index c83c40d0a4..8da65ecb9f 100644 --- a/frontend/packages/core/src/utils/pathMatching.tsx +++ b/frontend/packages/core/src/utils/pathMatching.tsx @@ -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)); diff --git a/frontend/packages/tools/yarn.config.cjs b/frontend/packages/tools/yarn.config.cjs index ea79b0c9e2..18e37667bb 100644 --- a/frontend/packages/tools/yarn.config.cjs +++ b/frontend/packages/tools/yarn.config.cjs @@ -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", diff --git a/frontend/workflows/projectCatalog/package.json b/frontend/workflows/projectCatalog/package.json index 1d207d093c..4d5a54c85b 100644 --- a/frontend/workflows/projectCatalog/package.json +++ b/frontend/workflows/projectCatalog/package.json @@ -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": { diff --git a/frontend/workflows/projectCatalog/src/details/components/layout.tsx b/frontend/workflows/projectCatalog/src/details/components/layout.tsx index 589eb37521..ed2624933d 100644 --- a/frontend/workflows/projectCatalog/src/details/components/layout.tsx +++ b/frontend/workflows/projectCatalog/src/details/components/layout.tsx @@ -32,7 +32,7 @@ const CatalogLayout = ({ allowDisabled, quickLinkSettings = true, }: CatalogLayoutProps) => { - const { projectId } = useParams(); + const { projectId = "" } = useParams(); const navigate = useNavigate(); const [projectInfo, setProjectInfo] = React.useState( null @@ -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 ( diff --git a/frontend/workflows/projectCatalog/src/details/components/link-settings.tsx b/frontend/workflows/projectCatalog/src/details/components/link-settings.tsx index 91602274bb..ab10f34cca 100644 --- a/frontend/workflows/projectCatalog/src/details/components/link-settings.tsx +++ b/frontend/workflows/projectCatalog/src/details/components/link-settings.tsx @@ -1,5 +1,4 @@ import React from "react"; -import { useParams } from "react-router-dom"; import { checkFeatureEnabled, Grid, @@ -11,6 +10,7 @@ import { QuickLinksCard, styled, Typography, + useParams, } from "@clutch-sh/core"; import SettingsIcon from "@mui/icons-material/Settings"; import { isEmpty } from "lodash"; diff --git a/frontend/yarn.lock b/frontend/yarn.lock index c68ecceef2..36b1a397f8 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1909,8 +1909,7 @@ __metadata: material-table: "npm:^2.0.3" react-hook-form: "npm:^7.25.3" react-is: "npm:^17.0.2" - react-router: "npm:^6.0.0-beta.0" - react-router-dom: "npm:^6.0.0-beta.0" + react-router-dom: "npm:6.0.0" react-test-renderer: "npm:^17.0.2" react-timeago: "npm:^7.0.0" recharts: "npm:^2.1.9" @@ -2087,7 +2086,6 @@ __metadata: "@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 languageName: unknown linkType: soft @@ -10745,6 +10743,15 @@ __metadata: languageName: node linkType: hard +"history@npm:^5.0.3": + version: 5.3.0 + resolution: "history@npm:5.3.0" + dependencies: + "@babel/runtime": "npm:^7.7.6" + checksum: 10c0/812ec839386222d6437bd78d9f05db32e47d105ada0ad8834b32626919dd2fee7a10001bc489510f93a8069d02f118214bd8d42a82f7cf9daf8e84fbcbbb2016 + languageName: node + linkType: hard + "hoist-non-react-statics@npm:^3.3.0, hoist-non-react-statics@npm:^3.3.1, hoist-non-react-statics@npm:^3.3.2": version: 3.3.2 resolution: "hoist-non-react-statics@npm:3.3.2" @@ -15802,29 +15809,26 @@ __metadata: languageName: node linkType: hard -"react-router-dom@npm:6.0.0-beta.0": - version: 6.0.0-beta.0 - resolution: "react-router-dom@npm:6.0.0-beta.0" +"react-router-dom@npm:6.0.0": + version: 6.0.0 + resolution: "react-router-dom@npm:6.0.0" dependencies: - prop-types: "npm:^15.7.2" - react-router: "npm:6.0.0-beta.0" + react-router: "npm:6.0.0" peerDependencies: - history: ">=5" react: ">=16.8" react-dom: ">=16.8" - checksum: 10c0/7eaedbca246fbfbc46b3354b2893144d93c882900d4902023cd89d0969a4c610a33ebd621951221ac0c70b01ecf1925b2edd6b478773133ac4a8164bf5277611 + checksum: 10c0/1420d6963dcf280e3275810f2ba8a803c9c885820d0186f7443a1c8701fc666c24b06b89abb1e3888a50539a6f11ee2f83472a2c54979770f4acaec41be99406 languageName: node linkType: hard -"react-router@npm:6.0.0-beta.0": - version: 6.0.0-beta.0 - resolution: "react-router@npm:6.0.0-beta.0" +"react-router@npm:6.0.0": + version: 6.0.0 + resolution: "react-router@npm:6.0.0" dependencies: - prop-types: "npm:^15.7.2" + history: "npm:^5.0.3" peerDependencies: - history: ">=5" react: ">=16.8" - checksum: 10c0/5b08018ea1d77f04d39041fa271ad9c4267715bc930f3f6fe69b59e6a141309aa017578aa648113d864b9ccb39487f43637edfc7b52542dbc1838fbf42a61c7c + checksum: 10c0/eb4ee497ab8609ebd0c940dbd85c31c67d9ee5290d5cbf6e99eec9ac3e8c49192152afcf6c91e007547e78f491b92d673964b21fda83b0fc5f774eed6f47d8f5 languageName: node linkType: hard diff --git a/tools/scaffolding/templates/frontend/workflow/external/package.json b/tools/scaffolding/templates/frontend/workflow/external/package.json index b958ab1357..cd1ba17d00 100644 --- a/tools/scaffolding/templates/frontend/workflow/external/package.json +++ b/tools/scaffolding/templates/frontend/workflow/external/package.json @@ -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": {