From 976b1a545c7c2093047146e77d4cbc73513b7f0d Mon Sep 17 00:00:00 2001 From: Giulia Ghisini Date: Thu, 11 Jul 2024 10:46:38 +0200 Subject: [PATCH] fix: order of hooks --- src/components/GdprPrivacyManager/GdprPrivacyManager.jsx | 6 +++--- src/helpers/usePanelConfigAndPreferences.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/GdprPrivacyManager/GdprPrivacyManager.jsx b/src/components/GdprPrivacyManager/GdprPrivacyManager.jsx index 6fabc68..69577c3 100644 --- a/src/components/GdprPrivacyManager/GdprPrivacyManager.jsx +++ b/src/components/GdprPrivacyManager/GdprPrivacyManager.jsx @@ -14,13 +14,13 @@ import GdprPrivacyManagerIncludeComponents from './GdprPrivacyManagerIncludeComp const GdprPrivacyManager = () => { const location = useLocation(); const isCmsUI = isCmsUi(location.pathname); + const cookies = new GDPRCookies(); + usePanelConfigAndPreferences(cookies); //to init data from panel + if (isCmsUI || isPageSpeedBot()) { return <>; } - const cookies = new GDPRCookies(); - usePanelConfigAndPreferences(cookies); //to init data from panel - return ( <> diff --git a/src/helpers/usePanelConfigAndPreferences.js b/src/helpers/usePanelConfigAndPreferences.js index fedd863..17af5fd 100644 --- a/src/helpers/usePanelConfigAndPreferences.js +++ b/src/helpers/usePanelConfigAndPreferences.js @@ -5,6 +5,7 @@ import config from '@plone/volto/registry'; const usePanelConfigAndPreferences = (cookies, forceLoad) => { // BBB for sites that had the old version with hardcoded panelConfig + const hasOldStyleConfig = !!config.settings['volto-gdpr-privacy']?.defaultPanelConfig; const oldStylePanelConfig = useMemo(() => {