Skip to content

Commit 1ea4450

Browse files
authored
Merge pull request #16142 from ethereum/en-only-ab-test
patch: use fallback/original variant for non-EN A/B tests
2 parents 1e57de4 + ee2bd00 commit 1ea4450

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/AB/TestWrapper.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import { getLocale } from "next-intl/server"
12
import type { ReactNode } from "react"
23

34
import { IS_PREVIEW_DEPLOY, IS_PROD } from "@/lib/utils/env"
45

6+
import { DEFAULT_LOCALE } from "@/lib/constants"
7+
58
import { ClientABTestWrapper } from "./ClientABTestWrapper"
69
import { ABTestDebugPanel } from "./TestDebugPanel"
710
import { ABTestTracker } from "./TestTracker"
@@ -13,13 +16,19 @@ type ABTestWrapperProps = {
1316
testKey: string
1417
variants: ABTestVariants
1518
fallback?: ReactNode
19+
enableAllLocales?: boolean
1620
}
1721

1822
const ABTestWrapper = async ({
1923
testKey,
2024
variants,
2125
fallback,
26+
enableAllLocales,
2227
}: ABTestWrapperProps) => {
28+
const locale = await getLocale()
29+
if (locale !== DEFAULT_LOCALE && !enableAllLocales)
30+
return <>{fallback || variants[0]}</>
31+
2332
try {
2433
// Get deterministic assignment
2534
const assignment = await getABTestAssignment(testKey)

0 commit comments

Comments
 (0)