diff --git a/tools/ui/src/lib/utils/uri-template.ts b/tools/ui/src/lib/utils/uri-template.ts index 7665c98c9..eb8dbfb36 100644 --- a/tools/ui/src/lib/utils/uri-template.ts +++ b/tools/ui/src/lib/utils/uri-template.ts @@ -160,7 +160,7 @@ export function expandTemplate(template: string, values: Record) (name: string, i: number) => `${encodeURIComponent(name)}=${encodeURIComponent(expandedParts[i])}` ) - .join(URI_TEMPLATE_SEPARATORS.COMMA) + .join(URI_TEMPLATE_SEPARATORS.QUERY_CONTINUATION) ); case URI_TEMPLATE_OPERATORS.FORM_CONTINUATION: // Form-style query continuation diff --git a/tools/ui/tests/unit/uri-template.test.ts b/tools/ui/tests/unit/uri-template.test.ts index 622127923..23645af3f 100644 --- a/tools/ui/tests/unit/uri-template.test.ts +++ b/tools/ui/tests/unit/uri-template.test.ts @@ -107,6 +107,14 @@ describe('expandTemplate', () => { expect(result).toBe('http://example.com?q=search%20term'); }); + it('expands multiple query parameters', () => { + const result = expandTemplate('http://example.com{?q,sort}', { + q: 'search term', + sort: 'descending' + }); + expect(result).toBe('http://example.com?q=search%20term&sort=descending'); + }); + it('keeps static parts unchanged', () => { const result = expandTemplate('http://example.com/static', {}); expect(result).toBe('http://example.com/static');