Repository navigation
fix(query): encode empty array strings as bare keys - #395
owenshen0907 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Empty-string array values use the intended bare-key encoding without changing how those keys parse. No merge-blocking issue was found. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review details
Pre-merge checks |
|
|
This is now ready for review. Local lint, type checks, build, and all 503 tests pass. Could a maintainer please approve the pending fork CI and autofix CI, and review this scoped fix for #394? The serialized URL spelling change and potential overlap with #391 are described above. Thank you for taking a look. |
abhi-byte62
left a comment
There was a problem hiding this comment.
Thanks for putting this together so quickly!
- Encoding empty string array items as bare keys brings complete consistency with scalar empty string encoding (\lag\ instead of \lag=).
- Clean check in \encodeQueryItem\ preserving existing behavior for
ull, \undefined, and truthy/falsy values. - Comprehensive test coverage in \query.test.ts\ including round-trip assertions and mixed array items.
An empty scalar query value encodes as
flag, but an empty string inside an array encodes asflag=. This produces different URL representations for the same empty value (#394).Encode empty string array elements as bare keys, matching scalar empty strings. For example,
encodeQueryItem("flag", ["", "value", ""])now returnsflag&flag=value&flag. Null/undefined array elements, zero, false, nonempty values, and empty arrays retain their existing behavior. Parsed query values remain the same; the serialized URL spelling changes for empty string array elements.The regression tests reproduce the issue on main and cover encoded keys, mixed values, stringify/parse round trips, and withQuery output. Six new cases fail before the fix.
Validation (Node 22.23.3, pnpm 10.33.2):
pnpm test— ESLint, Prettier, 503 tests, and type checks passedpnpm build— ESM, CJS, and declarations passedgit diff --check— passedPotential overlap: #391 optimizes the same array branch but preserves this bug. This small behavioral fix may need rebasing if that PR lands first.
Resolves #394.
Prepared with AI assistance; the regression and validation results above were verified locally.
Upstream CI status: ci run and autofix.ci run currently report
action_requiredwith no jobs executed. They require upstream approval; local validation above is complete.Summary by CodeRabbit