Skip to content

Commit 0cebfba

Browse files
authored
Decoding the values before setting it to the URL (#4962)
1 parent 574cca8 commit 0cebfba

File tree

1 file changed

+6
-2
lines changed
  • ui/packages/shared/components/src/hooks/URLState

1 file changed

+6
-2
lines changed

ui/packages/shared/components/src/hooks/URLState/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ export const sanitize = (
7373
): Record<string, ParamValue> => {
7474
const sanitized: Record<string, ParamValue> = {};
7575
for (const [key, value] of Object.entries(params)) {
76-
if (isEmpty(value) || isEqual(value, defaultValues[key])) {
76+
if (isEmpty(value) || isEqual(value, defaultValues[key]) || value == null) {
7777
continue;
7878
}
79-
sanitized[key] = value;
79+
if (Array.isArray(value)) {
80+
sanitized[key] = value.map(v => encodeURIComponent(v));
81+
} else {
82+
sanitized[key] = encodeURIComponent(value);
83+
}
8084
}
8185
return sanitized;
8286
};

0 commit comments

Comments
 (0)