Skip to content

Commit

Permalink
Decoding the values before setting it to the URL (#4962)
Browse files Browse the repository at this point in the history
  • Loading branch information
manojVivek authored Aug 9, 2024
1 parent 574cca8 commit 0cebfba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ui/packages/shared/components/src/hooks/URLState/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ export const sanitize = (
): Record<string, ParamValue> => {
const sanitized: Record<string, ParamValue> = {};
for (const [key, value] of Object.entries(params)) {
if (isEmpty(value) || isEqual(value, defaultValues[key])) {
if (isEmpty(value) || isEqual(value, defaultValues[key]) || value == null) {
continue;
}
sanitized[key] = value;
if (Array.isArray(value)) {
sanitized[key] = value.map(v => encodeURIComponent(v));
} else {
sanitized[key] = encodeURIComponent(value);
}
}
return sanitized;
};

0 comments on commit 0cebfba

Please sign in to comment.