Skip to content

Commit ae27839

Browse files
refactor(featureFlags): centralize ?ff= reading with the other query-state readers (#15044)
## Summary Reuse Vue Router's existing query parser for `?ff=` instead of parsing `window.location.search` independently with `URLSearchParams`. ## Changes - Replace the local `URLSearchParams` reader in `sessionFeatureFlagOverride.ts` with `parseQuery`. - Preserve pre-router synchronous access, repeated `?ff=` parameters, nameless clearing, typed values, persistence, and employee gating. - No new modules, router hooks, state, dependencies, or tests. Fixes FE-1551 ## Verification - `pnpm test:unit src/utils/sessionFeatureFlagOverride.test.ts` - `pnpm typecheck` - `pnpm lint` - `pnpm knip` - `pnpm exec oxfmt --check src/utils/sessionFeatureFlagOverride.ts` Co-authored-by: ShihChi Huang <shh@theonlyperson.com>
1 parent 022c843 commit ae27839

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/utils/sessionFeatureFlagOverride.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { parseQuery } from 'vue-router'
12
import { useCurrentUser } from 'vuefire'
23

34
import { isCloud } from '@/platform/distribution/types'
@@ -103,11 +104,9 @@ function splitRequest(request: string): [name: string, value?: string] {
103104
}
104105

105106
function readOverrideRequests(search: string): string[] {
106-
try {
107-
return new URLSearchParams(search).getAll(QUERY_PARAM)
108-
} catch {
109-
return []
110-
}
107+
const value = parseQuery(search)[QUERY_PARAM]
108+
if (value === undefined) return []
109+
return (Array.isArray(value) ? value : [value]).map((value) => value ?? '')
111110
}
112111

113112
/**

0 commit comments

Comments
 (0)