Repository navigation
fix(sdk): send fallbackLocale false to the REST API - #19049
NgoQuocViet2001 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Serialize fallback locale values packages/sdk/src/utilities/buildSearchParams.ts, packages/sdk/src/utilities/buildSearchParams.spec.ts |
The parameter check now includes false. Tests expect string and false values to appear as fallback-locale, alongside locale=es. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: alessiogr
Merge Risk: 
Minimal · up to 23ac0
-
The change correctly preserves explicit fallback-locale=false behavior without identified merge-blocking risk.
Architecture risk: 
Low · up to 23ac0
-
The change affects 1 system.
Changed systems:
packages/sdkArchitecture concerns
No architecture-level concerns identified.Review details
-
Systems and components
- observed — packages/sdk (library) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in packages/sdk/src/utilities/buildSearchParams.spec.ts: Adds tests expecting string and
falsevalues forfallbackLocaleto appear asfallback-localein the query string, alongsidelocale=es. - observed — Modified behavior in packages/sdk/src/utilities/buildSearchParams.ts: The
fallbackLocalecheck now includesfalse; previously, false values were omitted. Included values are still stringified asfallback-locale.
-
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
What?
fallbackLocale: falseis dropped from the request URL for every SDK operation.buildSearchParamsonly addsfallback-localewhen the value is truthy, sosdk.find({ collection: 'posts', locale: 'es', fallbackLocale: false })requests?locale=esinstead of?fallback-locale=false&locale=es.Why?
The SDK option types accept
false, and the REST API already treatsfallback-locale=falseas "no fallback". Without the param, the server falls back to the default locale whenlocalization.fallbackis enabled, so untranslated localized fields come back with default-locale content even though the caller turned fallback off.How?
Serialize
fallbackLocalewhen it isfalsetoo, and add a unit spec forbuildSearchParamsthat covers a locale string andfalse.vitest run --project unit packages/sdk/src/utilities/buildSearchParams.spec.ts. Thefalsecase fails on main (expected '?locale=es' to be '?fallback-locale=false&locale=es') and both cases pass with this change.sanitizeFallbackLocaleasfalse, and?locale=eswithout the option still resolves to the default locale.oxfmt --checkpasses on both files.