Skip to content

Commit

Permalink
Merge pull request #275 from amam-deriv/amam/disable-growthbook-cache
Browse files Browse the repository at this point in the history
amam/disable cache for development and staging
  • Loading branch information
farrah-deriv committed Aug 14, 2024
2 parents 125f0a1 + 5774557 commit 4683f70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hooks/custom-hooks/__tests__/useDerivAnalytics.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ describe('useDerivAnalytics', () => {
expect(Analytics.initialise).toHaveBeenCalledWith({
growthbookDecryptionKey: process.env.VITE_GROWTHBOOK_DECRYPTION_KEY,
growthbookKey: process.env.VITE_GROWTHBOOK_CLIENT_KEY,
growthbookOptions: {
disableCache: true,
},
rudderstackKey: process.env.VITE_RUDDERSTACK_KEY || '',
});

Expand Down
4 changes: 4 additions & 0 deletions src/hooks/custom-hooks/useDerivAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const useDerivAnalytics = () => {
try {
const isDerivAnalyticsInitialized = Analytics?.getInstances()?.tracking?.has_initialized;
const isLocalHost = location.hostname === 'localhost';
const isProduction = process.env.NODE_ENV === 'production';

if (!isLocalHost && !isDerivAnalyticsInitialized) {
const remoteConfigURL = process.env.VITE_REMOTE_CONFIG_URL;
Expand All @@ -43,6 +44,9 @@ const useDerivAnalytics = () => {
? process.env.VITE_GROWTHBOOK_DECRYPTION_KEY
: undefined,
growthbookKey: services?.marketing_growthbook ? process.env.VITE_GROWTHBOOK_CLIENT_KEY : undefined,
growthbookOptions: {
disableCache: !isProduction,
},
rudderstackKey: services?.tracking_rudderstack ? process.env.VITE_RUDDERSTACK_KEY || '' : '',
});

Expand Down

0 comments on commit 4683f70

Please sign in to comment.