Skip to content

Commit f867504

Browse files
authored
return empty string when empty, not null (#54262)
1 parent 2c8a55f commit f867504

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/events/components/experiments/experiment.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ if (typeof window !== 'undefined') {
8383
export function getExperimentControlGroupFromSession(
8484
experimentKey: ExperimentNames,
8585
percentToGetExperiment = 50,
86-
) {
86+
): string {
8787
if (controlGroupOverride[experimentKey]) {
8888
return controlGroupOverride[experimentKey]
8989
} else if (process.env.NODE_ENV === 'development') {
@@ -99,7 +99,7 @@ export function getExperimentControlGroupFromSession(
9999
return modHash < percentToGetExperiment ? TREATMENT_VARIATION : CONTROL_VARIATION
100100
}
101101

102-
export function getExperimentVariationForContext(locale: string) {
102+
export function getExperimentVariationForContext(locale: string): string {
103103
const experiments = getActiveExperiments(locale)
104104
for (const experiment of experiments) {
105105
if (experiment.includeVariationInContext) {
@@ -111,7 +111,7 @@ export function getExperimentVariationForContext(locale: string) {
111111
}
112112

113113
// When no experiment has `includeVariationInContext: true`
114-
return null
114+
return ''
115115
}
116116

117117
export function initializeExperiments(locale: string) {

0 commit comments

Comments
 (0)