From 55fc3a2bc31f5eca3edfc93e9362461e6c4313f3 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Tue, 26 Oct 2021 17:27:48 +0200 Subject: [PATCH] Remplace react-helmet par react-helmet-async MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Motivation : https://github.com/nfl/react-helmet/issues/426#issuecomment-690925576 Popularité relative : https://www.npmtrends.com/react-helmet-vs-react-helmet-async --- mon-entreprise/package.json | 3 +- mon-entreprise/source/App.tsx | 2 +- mon-entreprise/source/Provider.tsx | 9 ++-- .../source/components/TypeFormEmbed.js | 2 +- .../components/layout/Footer/Footer.tsx | 2 +- .../source/components/utils/Meta.tsx | 2 +- mon-entreprise/source/pages/Budget/Budget.tsx | 2 +- .../source/pages/Créer/CreationChecklist.tsx | 2 +- .../Créer/GuideStatut/AutoEntrepreneur.tsx | 2 +- .../Créer/GuideStatut/DirectorStatus.tsx | 2 +- .../Créer/GuideStatut/MinorityDirector.tsx | 2 +- .../Créer/GuideStatut/NumberOfAssociate.tsx | 2 +- .../Créer/GuideStatut/PickLegalStatus.tsx | 2 +- .../Créer/GuideStatut/SoleProprietorship.tsx | 2 +- .../source/pages/Gérer/Embaucher.tsx | 2 +- .../source/pages/Gérer/SécuritéSociale.tsx | 2 +- mon-entreprise/source/pages/Iframes/index.tsx | 2 +- .../source/pages/Simulateurs/Home.tsx | 2 +- .../ÉconomieCollaborative/VotreSituation.tsx | 2 +- package.json | 1 - publicodes/site/components/Provider.tsx | 9 ++-- publicodes/ui-react/package.json | 2 +- publicodes/ui-react/source/rule/Meta.tsx | 2 +- yarn.lock | 45 +++++++------------ 24 files changed, 49 insertions(+), 56 deletions(-) diff --git a/mon-entreprise/package.json b/mon-entreprise/package.json index cdd3f2fc9..2cbff10eb 100644 --- a/mon-entreprise/package.json +++ b/mon-entreprise/package.json @@ -31,7 +31,6 @@ "@types/react": "^17.0.0", "@types/react-color": "^3.0.1", "@types/react-dom": "^17.0.9", - "@types/react-helmet": "^6.1.0", "@types/react-redux": "^7.1.11", "@types/react-router": "^5.1.2", "@types/recharts": "^1.8.16", @@ -84,7 +83,7 @@ "react-color": "^2.14.0", "react-dom": "npm:@hot-loader/react-dom", "react-easy-emoji": "^1.2.0", - "react-helmet": "^6.1.0", + "react-helmet-async": "^1.1.2", "react-i18next": "^11.0.0", "react-instantsearch": "^6.11.2", "react-instantsearch-dom": "^6.11.2", diff --git a/mon-entreprise/source/App.tsx b/mon-entreprise/source/App.tsx index b9a6bcede..48215879d 100644 --- a/mon-entreprise/source/App.tsx +++ b/mon-entreprise/source/App.tsx @@ -11,7 +11,7 @@ import { import { SitePathsContext } from 'Components/utils/SitePathsContext' import 'iframe-resizer' import { StrictMode, useContext, useMemo } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { Redirect, Route, Switch } from 'react-router-dom' diff --git a/mon-entreprise/source/Provider.tsx b/mon-entreprise/source/Provider.tsx index 1b128139f..02d2dcd81 100644 --- a/mon-entreprise/source/Provider.tsx +++ b/mon-entreprise/source/Provider.tsx @@ -5,6 +5,7 @@ import { SitePathProvider, SitePaths } from 'Components/utils/SitePathsContext' import { createBrowserHistory } from 'history' import i18next from 'i18next' import React, { createContext, useMemo } from 'react' +import { HelmetProvider } from 'react-helmet-async' import { I18nextProvider } from 'react-i18next' import { Provider as ReduxProvider } from 'react-redux' import { Router } from 'react-router-dom' @@ -161,9 +162,11 @@ export default function Provider({ - - <>{children} - + + + <>{children} + + diff --git a/mon-entreprise/source/components/TypeFormEmbed.js b/mon-entreprise/source/components/TypeFormEmbed.js index e98b0c83c..ae15cc760 100644 --- a/mon-entreprise/source/components/TypeFormEmbed.js +++ b/mon-entreprise/source/components/TypeFormEmbed.js @@ -1,4 +1,4 @@ -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' let createQueryParams = (params) => Object.keys(params) diff --git a/mon-entreprise/source/components/layout/Footer/Footer.tsx b/mon-entreprise/source/components/layout/Footer/Footer.tsx index fe8a7c7ae..379952479 100644 --- a/mon-entreprise/source/components/layout/Footer/Footer.tsx +++ b/mon-entreprise/source/components/layout/Footer/Footer.tsx @@ -4,7 +4,7 @@ import SocialIcon from 'Components/ui/SocialIcon' import Emoji from 'Components/utils/Emoji' import { SitePathsContext } from 'Components/utils/SitePathsContext' import { useContext } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { Link, useLocation } from 'react-router-dom' import styled from 'styled-components' diff --git a/mon-entreprise/source/components/utils/Meta.tsx b/mon-entreprise/source/components/utils/Meta.tsx index f2425fde7..bad419c08 100644 --- a/mon-entreprise/source/components/utils/Meta.tsx +++ b/mon-entreprise/source/components/utils/Meta.tsx @@ -1,4 +1,4 @@ -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { useTranslation } from 'react-i18next' import { useLocation } from 'react-router' diff --git a/mon-entreprise/source/pages/Budget/Budget.tsx b/mon-entreprise/source/pages/Budget/Budget.tsx index 9ecefccbf..532f64bba 100644 --- a/mon-entreprise/source/pages/Budget/Budget.tsx +++ b/mon-entreprise/source/pages/Budget/Budget.tsx @@ -5,7 +5,7 @@ import { ScrollToTop } from 'Components/utils/Scroll' import { formatValue } from 'publicodes' import { sum, uniq } from 'ramda' import { useState } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { useTranslation } from 'react-i18next' import styled from 'styled-components' import { TrackPage } from '../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Créer/CreationChecklist.tsx b/mon-entreprise/source/pages/Créer/CreationChecklist.tsx index ae71419c6..8441bba3b 100644 --- a/mon-entreprise/source/pages/Créer/CreationChecklist.tsx +++ b/mon-entreprise/source/pages/Créer/CreationChecklist.tsx @@ -9,7 +9,7 @@ import Emoji from 'Components/utils/Emoji' import Scroll from 'Components/utils/Scroll' import { SitePathsContext } from 'Components/utils/SitePathsContext' import { useContext } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { useDispatch, useSelector } from 'react-redux' import { Link, useHistory } from 'react-router-dom' diff --git a/mon-entreprise/source/pages/Créer/GuideStatut/AutoEntrepreneur.tsx b/mon-entreprise/source/pages/Créer/GuideStatut/AutoEntrepreneur.tsx index 1c9ebca13..62940a0a8 100644 --- a/mon-entreprise/source/pages/Créer/GuideStatut/AutoEntrepreneur.tsx +++ b/mon-entreprise/source/pages/Créer/GuideStatut/AutoEntrepreneur.tsx @@ -1,5 +1,5 @@ import SchemeComparaison from 'Components/SchemeComparaison' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { TrackPage } from '../../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Créer/GuideStatut/DirectorStatus.tsx b/mon-entreprise/source/pages/Créer/GuideStatut/DirectorStatus.tsx index ef0187a09..dc2c07ad3 100644 --- a/mon-entreprise/source/pages/Créer/GuideStatut/DirectorStatus.tsx +++ b/mon-entreprise/source/pages/Créer/GuideStatut/DirectorStatus.tsx @@ -1,5 +1,5 @@ import SchemeComparaison from 'Components/SchemeComparaison' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { TrackPage } from '../../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Créer/GuideStatut/MinorityDirector.tsx b/mon-entreprise/source/pages/Créer/GuideStatut/MinorityDirector.tsx index cb7b4b277..51e28a79c 100644 --- a/mon-entreprise/source/pages/Créer/GuideStatut/MinorityDirector.tsx +++ b/mon-entreprise/source/pages/Créer/GuideStatut/MinorityDirector.tsx @@ -2,7 +2,7 @@ import { directorIsInAMinority, useDispatchAndGoToNextQuestion, } from 'Actions/companyStatusActions' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { TrackPage } from '../../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Créer/GuideStatut/NumberOfAssociate.tsx b/mon-entreprise/source/pages/Créer/GuideStatut/NumberOfAssociate.tsx index 4f892b82c..a340715af 100644 --- a/mon-entreprise/source/pages/Créer/GuideStatut/NumberOfAssociate.tsx +++ b/mon-entreprise/source/pages/Créer/GuideStatut/NumberOfAssociate.tsx @@ -2,7 +2,7 @@ import { companyHasMultipleAssociates, useDispatchAndGoToNextQuestion, } from 'Actions/companyStatusActions' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { TrackPage } from '../../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Créer/GuideStatut/PickLegalStatus.tsx b/mon-entreprise/source/pages/Créer/GuideStatut/PickLegalStatus.tsx index b16f18d7d..52c3a3d0b 100644 --- a/mon-entreprise/source/pages/Créer/GuideStatut/PickLegalStatus.tsx +++ b/mon-entreprise/source/pages/Créer/GuideStatut/PickLegalStatus.tsx @@ -1,7 +1,7 @@ import { SitePathsContext } from 'Components/utils/SitePathsContext' import { filter } from 'ramda' import { useContext } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' import { Link } from 'react-router-dom' diff --git a/mon-entreprise/source/pages/Créer/GuideStatut/SoleProprietorship.tsx b/mon-entreprise/source/pages/Créer/GuideStatut/SoleProprietorship.tsx index 355f8acca..9b76da07b 100644 --- a/mon-entreprise/source/pages/Créer/GuideStatut/SoleProprietorship.tsx +++ b/mon-entreprise/source/pages/Créer/GuideStatut/SoleProprietorship.tsx @@ -2,7 +2,7 @@ import { isSoleProprietorship, useDispatchAndGoToNextQuestion, } from 'Actions/companyStatusActions' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { TrackPage } from '../../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Gérer/Embaucher.tsx b/mon-entreprise/source/pages/Gérer/Embaucher.tsx index 37195af26..34b4aa7d7 100644 --- a/mon-entreprise/source/pages/Gérer/Embaucher.tsx +++ b/mon-entreprise/source/pages/Gérer/Embaucher.tsx @@ -4,7 +4,7 @@ import { } from 'Actions/hiringChecklistAction' import { FromBottom } from 'Components/ui/animate' import { CheckItem, Checklist, ChecklistProps } from 'Components/ui/Checklist' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { connect, useSelector } from 'react-redux' import { RootState } from 'Reducers/rootReducer' diff --git a/mon-entreprise/source/pages/Gérer/SécuritéSociale.tsx b/mon-entreprise/source/pages/Gérer/SécuritéSociale.tsx index 8cce4abba..252a451f3 100644 --- a/mon-entreprise/source/pages/Gérer/SécuritéSociale.tsx +++ b/mon-entreprise/source/pages/Gérer/SécuritéSociale.tsx @@ -1,5 +1,5 @@ import { FromBottom } from 'Components/ui/animate' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { TrackPage } from '../../ATInternetTracking' import Video from './Video' diff --git a/mon-entreprise/source/pages/Iframes/index.tsx b/mon-entreprise/source/pages/Iframes/index.tsx index 8ebdb9ec2..238ebe1bc 100644 --- a/mon-entreprise/source/pages/Iframes/index.tsx +++ b/mon-entreprise/source/pages/Iframes/index.tsx @@ -1,6 +1,6 @@ import { IsEmbeddedContext } from 'Components/utils/embeddedContext' import { useEffect } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Route, Switch } from 'react-router-dom' import useSimulatorsData from '../Simulateurs/metadata' import SimulateurPage from '../Simulateurs/Page' diff --git a/mon-entreprise/source/pages/Simulateurs/Home.tsx b/mon-entreprise/source/pages/Simulateurs/Home.tsx index ed5b72515..0fc63f1f3 100644 --- a/mon-entreprise/source/pages/Simulateurs/Home.tsx +++ b/mon-entreprise/source/pages/Simulateurs/Home.tsx @@ -6,7 +6,7 @@ import Emoji from 'Components/utils/Emoji' import { HeadingWithAnchorLink } from 'Components/utils/markdown' import { SitePathsContext } from 'Components/utils/SitePathsContext' import { useContext } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' import { TrackPage } from '../../ATInternetTracking' diff --git a/mon-entreprise/source/pages/Simulateurs/ÉconomieCollaborative/VotreSituation.tsx b/mon-entreprise/source/pages/Simulateurs/ÉconomieCollaborative/VotreSituation.tsx index 1964996dc..cc1130680 100644 --- a/mon-entreprise/source/pages/Simulateurs/ÉconomieCollaborative/VotreSituation.tsx +++ b/mon-entreprise/source/pages/Simulateurs/ÉconomieCollaborative/VotreSituation.tsx @@ -3,7 +3,7 @@ import Emoji from 'Components/utils/Emoji' import { ScrollToTop } from 'Components/utils/Scroll' import { SitePathsContext } from 'Components/utils/SitePathsContext' import { useContext } from 'react' -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' import { Trans, useTranslation } from 'react-i18next' import { Link, Redirect } from 'react-router-dom' import { TrackPage } from '../../../ATInternetTracking' diff --git a/package.json b/package.json index 2ccc27d04..092f1cf6a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@types/react": "^17.0.0", "@types/react-color": "^3.0.1", "@types/react-dom": "^17.0.0", - "@types/react-helmet": "^5.0.13", "@types/react-redux": "^7.1.11", "@types/react-router": "^5.1.2", "@types/react-router-hash-link": "^1.2.1", diff --git a/publicodes/site/components/Provider.tsx b/publicodes/site/components/Provider.tsx index 5c813f0e6..db18fd8d9 100644 --- a/publicodes/site/components/Provider.tsx +++ b/publicodes/site/components/Provider.tsx @@ -3,6 +3,7 @@ import { createBrowserHistory } from 'history' import React, { createContext, useMemo } from 'react' +import { HelmetProvider } from 'react-helmet-async' import { Router } from 'react-router-dom' import { ThemeColorsProvider } from './colors' @@ -55,9 +56,11 @@ export default function Provider({ basename, children }: ProviderProps) { return ( - - <>{children} - + + + <>{children} + + ) diff --git a/publicodes/ui-react/package.json b/publicodes/ui-react/package.json index 83c8bfffc..ad7c18c1f 100644 --- a/publicodes/ui-react/package.json +++ b/publicodes/ui-react/package.json @@ -19,7 +19,7 @@ "classnames": "^2.2.6", "focus-trap-react": "^3.1.2", "ramda": "^0.27.0", - "react-helmet": "^6.1.0", + "react-helmet-async": "^1.1.2", "react-markdown": "^4.3.1", "react-router-hash-link": "^2.4.3", "styled-components": "^5.1.0", diff --git a/publicodes/ui-react/source/rule/Meta.tsx b/publicodes/ui-react/source/rule/Meta.tsx index 537e7c905..27f95b96e 100644 --- a/publicodes/ui-react/source/rule/Meta.tsx +++ b/publicodes/ui-react/source/rule/Meta.tsx @@ -1,4 +1,4 @@ -import { Helmet } from 'react-helmet' +import { Helmet } from 'react-helmet-async' type PropType = { title: string diff --git a/yarn.lock b/yarn.lock index 47b5abe95..42a4ad46f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2493,6 +2493,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.12.5": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a" + integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" @@ -3566,20 +3573,6 @@ dependencies: "@types/react" "*" -"@types/react-helmet@^5.0.13": - version "5.0.16" - resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-5.0.16.tgz#dafac5f043665b880559285a27c71a69abd1f29e" - integrity sha512-++KMqwodVBg75hT2ZT4jobvDPi6iPUl/Lhrn0nP1XTcmFLtccaDb4FTAxzrj3egL7WQYTDnpHuPj52FSFkJqzA== - dependencies: - "@types/react" "*" - -"@types/react-helmet@^6.1.0": - version "6.1.0" - resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-6.1.0.tgz#af586ed685f4905e2adc7462d1d65ace52beee7a" - integrity sha512-PYRoU1XJFOzQ3BHvWL1T8iDNbRjdMDJMT5hFmZKGbsq09kbSqJy61uwEpTrbTNWDopVphUT34zUSVLK9pjsgYQ== - dependencies: - "@types/react" "*" - "@types/react-instantsearch-core@*": version "6.10.2" resolved "https://registry.yarnpkg.com/@types/react-instantsearch-core/-/react-instantsearch-core-6.10.2.tgz#634a887233ce76cc0f37a37f30909fe77a24d73b" @@ -5919,7 +5912,7 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -classnames@^2.2.5, classnames@^2.2.6: +classnames@^2.2.5: version "2.2.6" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce" integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q== @@ -13503,20 +13496,21 @@ react-easy-emoji@^1.2.0: lodash.assign "^4.0.8" string-replace-to-array "^1.0.1" -react-fast-compare@^3.0.0, react-fast-compare@^3.1.1: +react-fast-compare@^3.0.0, react-fast-compare@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== -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== +react-helmet-async@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.1.2.tgz#653b7e6bbfdd239c5dcd6b8df2811c7a363b8334" + integrity sha512-LTTzDDkyIleT/JJ6T/uqx7Y8qi1EuPPSiJawQY/nHHz0h7SPDT6HxP1YDDQx/fzcVxCqpWEEMS3QdrSrNkJYhg== dependencies: - object-assign "^4.1.1" + "@babel/runtime" "^7.12.5" + invariant "^2.2.4" prop-types "^15.7.2" - react-fast-compare "^3.1.1" - react-side-effect "^2.1.0" + react-fast-compare "^3.2.0" + shallowequal "^1.1.0" react-hot-loader@^4.12.15: version "4.12.21" @@ -13707,11 +13701,6 @@ react-shallow-renderer@^16.13.1: object-assign "^4.1.1" react-is "^16.12.0 || ^17.0.0" -react-side-effect@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.1.tgz#66c5701c3e7560ab4822a4ee2742dee215d72eb3" - integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ== - react-signature-pad-wrapper@^1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/react-signature-pad-wrapper/-/react-signature-pad-wrapper-1.2.11.tgz#fb017012611e2e5c09b5210d35d56c1180f19137"