From 749c9b40ea2a97b7352a0eccfbf44aca2d615061 Mon Sep 17 00:00:00 2001 From: eddie <66155195+just-toby@users.noreply.github.com> Date: Fri, 13 Oct 2023 09:27:15 -0700 Subject: [PATCH] fix: specify canonical URLs (#7455) * fix: app.uniswap.org canonicals * fix: deps test * fix: use window.location.origin --- package.json | 2 ++ src/index.tsx | 8 +++++++- yarn.lock | 30 ++++++++++++++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 86d377be8a..7db671e70a 100644 --- a/package.json +++ b/package.json @@ -191,6 +191,7 @@ "@sentry/react": "^7.45.0", "@sentry/tracing": "^7.45.0", "@sentry/types": "^7.45.0", + "@types/react-helmet": "^6.1.7", "@types/react-window-infinite-loader": "^1.0.6", "@uniswap/analytics": "1.5.0", "@uniswap/analytics-events": "^2.24.0", @@ -267,6 +268,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-feather": "^2.0.8", + "react-helmet": "^6.1.0", "react-infinite-scroll-component": "^6.1.0", "react-is": "^17.0.2", "react-markdown": "^4.3.1", diff --git a/src/index.tsx b/src/index.tsx index ead27ddc59..fbe006a152 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,9 +11,10 @@ import { BlockNumberProvider } from 'lib/hooks/useBlockNumber' import { MulticallUpdater } from 'lib/state/multicall' import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' +import { Helmet } from 'react-helmet' import { QueryClient, QueryClientProvider } from 'react-query' import { Provider } from 'react-redux' -import { BrowserRouter, HashRouter } from 'react-router-dom' +import { BrowserRouter, HashRouter, useLocation } from 'react-router-dom' import { SystemThemeUpdater, ThemeColorMetaUpdater } from 'theme/components/ThemeToggle' import { isBrowserRouterEnabled } from 'utils/env' @@ -35,8 +36,13 @@ if (window.ethereum) { } function Updaters() { + const location = useLocation() + const baseUrl = `${window.location.origin}${location.pathname}` return ( <> + + + diff --git a/yarn.lock b/yarn.lock index 5036ce978a..50505ed186 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5699,6 +5699,13 @@ dependencies: "@types/react" "*" +"@types/react-helmet@^6.1.7": + version "6.1.7" + resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-6.1.7.tgz#4cecc03165084727408d29d92d8fdd4a7e267403" + integrity sha512-mUFOrdR3AIvHE8BEaqzfPEnR62xq5PHQJehhgNtj78x0d5NOxUCQ0j+r9OZ4RvB+prNZx9wvQnVW8ApFBX+fig== + dependencies: + "@types/react" "*" + "@types/react-redux@^7.1.24": version "7.1.24" resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.24.tgz#6caaff1603aba17b27d20f8ad073e4c077e975c0" @@ -17488,10 +17495,10 @@ react-error-overlay@^6.0.11: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb" integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg== -react-fast-compare@^3.0.1: - version "3.2.0" - resolved "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz" - integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== +react-fast-compare@^3.0.1, react-fast-compare@^3.1.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49" + integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== react-feather@^2.0.8: version "2.0.9" @@ -17512,6 +17519,16 @@ react-focus-lock@^2.3.1: use-callback-ref "^1.2.1" use-sidecar "^1.0.1" +react-helmet@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726" + integrity sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw== + dependencies: + object-assign "^4.1.1" + prop-types "^15.7.2" + react-fast-compare "^3.1.1" + react-side-effect "^2.1.0" + react-infinite-scroll-component@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/react-infinite-scroll-component/-/react-infinite-scroll-component-6.1.0.tgz#7e511e7aa0f728ac3e51f64a38a6079ac522407f" @@ -17671,6 +17688,11 @@ react-scripts@^5.0.1: optionalDependencies: fsevents "^2.3.2" +react-side-effect@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.2.tgz#dc6345b9e8f9906dc2eeb68700b615e0b4fe752a" + integrity sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw== + react-spring@^9.5.5: version "9.5.5" resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-9.5.5.tgz#314009a65efc04d0ef157d3d60590dbb9de65f3c"