Skip to content

Commit 77db307

Browse files
@W-19143871 switch useConfigurations for footer component to be requested from client rather than server, so it doesn't need to be loaded on each page SSR.
1 parent a76af0c commit 77db307

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/template-retail-react-app/app/hooks/use-marketing-consent.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ import {ENABLE_CONSENT_WITH_MARKETING_CLOUD} from '@salesforce/retail-react-app/
7777
* const hasEmailChannel = hasChannel('marketing-email', 'email')
7878
*/
7979
export const useMarketingConsent = ({enabled = true, tags = [], expand} = {}) => {
80-
// Check if the feature is enabled via Shopper Configurations
81-
const {data: configurations} = useConfigurations()
80+
// Check if the feature is enabled via Shopper Configurations.
81+
// Client-only: skip during SSR to avoid adding an API call to every page render.
82+
const {data: configurations} = useConfigurations({}, {enabled: typeof window !== 'undefined'})
8283
const isFeatureEnabled =
8384
configurations?.configurations?.find(
8485
(config) => config.id === ENABLE_CONSENT_WITH_MARKETING_CLOUD

0 commit comments

Comments
 (0)