rapid-salesclerk-86901
05/29/2025, 6:09 PMsrc/growthbook/growthbook.ts
import { GrowthBook } from '@growthbook/growthbook';
// @ts-ignore
import { thirdPartyTrackingPlugin, autoAttributesPlugin } from '@growthbook/growthbook/plugins';
export const growthbook = new GrowthBook({
apiHost: 'https://cdn.growthbook.io',
clientKey: process.env.REACT_APP_GROWTHBOOK_CLIENT_KEY || '',
enableDevMode: true,
plugins: [autoAttributesPlugin(), thirdPartyTrackingPlugin({ trackers: ['ga4', 'gtm'] })],
});
src/growthbook/GrowthBookProvider.tsx
import React, { useEffect } from 'react';
import { GrowthBookProvider as GrowthBookProviderBase } from '@growthbook/growthbook-react';
import { growthbook } from './growthbook';
const GrowthBookProvider = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
growthbook.init({ streaming: true });
}, []);
return <GrowthBookProviderBase growthbook={growthbook}>{children}</GrowthBookProviderBase>;
};
export default GrowthBookProvider;
src/App.tsx
import GrowthBookProvider from './growthbook/GrowthBookProvider';
const App = () => {
...
return (
<GrowthBookProvider>
...
</GrowthBookProvider>
);
};
export default App;
src/app/features/Navigation/Navigation.tsx
import { Box, BoxProps, useBreakpointValue } from '@chakra-ui/react';
import React from 'react';
import { useSelector } from 'react-redux';
import { selectInteractions } from '../../redux/selectors/interactions.selectors';
import { selectVisitor } from '../../redux/selectors/visitor.selectors';
import { ABOVE_MODAL_Z_INDEX, NAVIGATION_Z_INDEX } from '../../shared/constants';
import GalleryWelcome from '../MultiGallery/GalleryWelcome';
import { DISCOUNTS_BANNER_HEIGHT } from './constants';
import DesktopNavigation from './DesktopNavigation';
import MobileActionBar from './MobileActionBar';
import StickyRibbon from '../../shared/components/StickyRibbon/StickyRibbon';
import { IfFeatureEnabled, useFeatureValue } from '@growthbook/growthbook-react';
import { STICKY_RIBBON_TEST } from '../../shared/constants/features-flags.constants';
const Navigation = (props: BoxProps) => {
const { isLoggedIn } = useSelector(selectVisitor);
const { showNav, showWelcomeModal, showFindGalleryModal } = useSelector(selectInteractions);
const value = useFeatureValue(STICKY_RIBBON_TEST, null);
const isMobile = useBreakpointValue({ base: true, md: false }, { ssr: false });
if (!isLoggedIn) {
return null;
}
return (
<Box
as="nav"
backgroundColor="white"
display={showNav ? undefined : 'none'}
position={isMobile ? 'sticky' : 'relative'}
top="0"
width={showFindGalleryModal ? '100vw' : undefined}
zIndex={showFindGalleryModal ? ABOVE_MODAL_Z_INDEX : NAVIGATION_Z_INDEX}
{...props}
>
{value ? (
<IfFeatureEnabled feature="sticky-ribbon">
<StickyRibbon>{value}</StickyRibbon>
</IfFeatureEnabled>
) : (
<Box background="black" height={${DISCOUNTS_BANNER_HEIGHT}px} width="100%">
{/* TODO: Replace this box with notification banner component */}
</Box>
)}
{isMobile ? <MobileActionBar showNavigation /> : <DesktopNavigation />}
{showWelcomeModal && <GalleryWelcome />}
</Box>
);
};
export default Navigation;strong-mouse-55694
05/29/2025, 7:11 PMrapid-salesclerk-86901
05/29/2025, 7:14 PMrapid-salesclerk-86901
05/29/2025, 7:15 PMstrong-mouse-55694
05/29/2025, 8:57 PMgalleryId
. With React, you can look at the code example for the setAttributes
part.
With the second screenshot, it says the experiment is no longer active, so that won't show up either. It also looks like under Dev
you have several more rules than in prod. That's fine but could also be complicating your debugging. My recommendation would be to start from scratch: create a new feature, add an experiment, and then check that out in the codebase to ensure everything is working as intended. Once you have your baseline, then you'll be ready to add in more complexity.rapid-salesclerk-86901
06/02/2025, 9:18 PM