diff --git a/.eslintrc b/.eslintrc index b6f5edb3..bf4f4f10 100644 --- a/.eslintrc +++ b/.eslintrc @@ -7,10 +7,7 @@ "plugin:react-hooks/recommended", "eslint:recommended" ], - "plugins": [ - "@typescript-eslint", - "react-hooks" - ], + "plugins": ["@typescript-eslint", "react-hooks"], "env": { "browser": true, "node": true, @@ -43,9 +40,7 @@ "react/react-in-jsx-scope": "off", // note you must disable the base rule as it can report incorrect errors "no-use-before-define": "off", - "@typescript-eslint/no-use-before-define": [ - "error" - ], + "@typescript-eslint/no-use-before-define": ["error"], "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ "error", @@ -64,12 +59,7 @@ "react/jsx-filename-extension": [ 1, { - "extensions": [ - ".js", - ".jsx", - ".ts", - ".tsx" - ] + "extensions": [".js", ".jsx", ".ts", ".tsx"] } ], "import/no-named-as-default": 0, @@ -86,16 +76,11 @@ } ], "no-restricted-syntax": "off", - "react/state-in-constructor": [ - "error", - "never" - ], + "react/state-in-constructor": ["error", "never"], "no-console": [ 1, { - "allow": [ - "error" - ] + "allow": ["error", "info"] } ], "import/no-extraneous-dependencies": [ @@ -107,15 +92,12 @@ "react/prop-types": "off", // Since we do not use prop-types "react/require-default-props": "off", // Since we do not use prop-types // disable the rule for all files - "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-function-return-type": "off" }, "overrides": [ { // enable the rule specifically for TypeScript files - "files": [ - "*.ts", - "*.tsx" - ], + "files": ["*.ts", "*.tsx"], "rules": { "@typescript-eslint/explicit-module-boundary-types": [ "error", @@ -127,46 +109,25 @@ }, { // enable the rule specifically for src files - "files": [ - "src/**/*.js", - "src/**/*.tsx", - "src/**/*.ts" - ], + "files": ["src/**/*.js", "src/**/*.tsx", "src/**/*.ts"], "rules": { - "no-restricted-syntax": [ - "error" - ] + "no-restricted-syntax": ["error"] } } ], "settings": { - "import/extensions": [ - ".js", - ".jsx", - ".ts", - ".tsx" - ], + "import/extensions": [".js", ".jsx", ".ts", ".tsx"], "import/parsers": { - "@typescript-eslint/parser": [ - ".ts", - ".tsx" - ] + "@typescript-eslint/parser": [".ts", ".tsx"] }, "import/resolver": { "typescript": { "alwaysTryTypes": true }, "node": { - "extensions": [ - ".js", - ".jsx", - ".ts", - ".tsx" - ] + "extensions": [".js", ".jsx", ".ts", ".tsx"] } } }, - "ignorePatterns": [ - "node_modules/*" - ] + "ignorePatterns": ["node_modules/*"] } diff --git a/src/App.tsx b/src/App.tsx index 966956be..56aae2aa 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,4 @@ import { useEffect } from 'react'; -import ReactGA from 'react-ga4'; import { Navigate, Route, @@ -8,11 +7,11 @@ import { useSearchParams, } from 'react-router-dom'; -import { hasAcceptedCookies, saveUrlForRedirection } from '@graasp/sdk'; +import { saveUrlForRedirection } from '@graasp/sdk'; import { CustomInitialLoader, withAuthorization } from '@graasp/ui'; import { SIGN_IN_PATH } from '@/config/constants'; -import { DOMAIN, GA_MEASUREMENT_ID } from '@/config/env'; +import { DOMAIN } from '@/config/env'; import { HOME_PATH, buildMainPath } from '@/config/paths'; import { useCurrentMemberContext } from '@/contexts/CurrentMemberContext'; import HomePage from '@/modules/pages/HomePage'; @@ -23,22 +22,17 @@ export const App = (): JSX.Element => { const [searchParams, setSearchParams] = useSearchParams(); const { data: currentMember, isLoading } = useCurrentMemberContext(); - useEffect(() => { - // REACTGA - // Send pageview with a custom path - if (GA_MEASUREMENT_ID && hasAcceptedCookies()) { - ReactGA.initialize(GA_MEASUREMENT_ID); - ReactGA.send('pageview'); - } - - // remove cross domain tracking query params - // eslint-disable-next-line no-console - console.log('removing google cross site tracking params after load'); - // eslint-disable-next-line no-console - console.log(searchParams); - searchParams.delete('_gl'); - setSearchParams(searchParams); - }, [location]); + useEffect( + () => { + if (searchParams.get('_gl')) + // remove cross domain tracking query params + console.info('Removing cross site tracking params'); + searchParams.delete('_gl'); + setSearchParams(searchParams); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [searchParams], + ); if (isLoading) { return ; diff --git a/src/Root.tsx b/src/Root.tsx index 08bca973..bdd1574d 100644 --- a/src/Root.tsx +++ b/src/Root.tsx @@ -1,4 +1,3 @@ -import { useEffect } from 'react'; import { I18nextProvider } from 'react-i18next'; import { BrowserRouter as Router } from 'react-router-dom'; import { ToastContainer } from 'react-toastify';