Skip to content

Commit b8ce49d

Browse files
author
Crhistian Ramirez
committed
🐛 don't mutate options object passed to SDK
The SDK was mutating the options object being passed in (deleting filters) There should be no side effects to using the SDK on parameters passed it
1 parent cdb134f commit b8ce49d

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

codegen/templates/utils/paramsSerializer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* @ignore
33
* not part of public api, don't include in generated docs
44
*/
5-
export default function ParamSerializer(params: {
5+
export default function ParamSerializer(originalParams: {
66
[key: string]: any
77
}): string {
8+
const params = JSON.parse(JSON.stringify(originalParams)) // don't mutate original object
89
const valuesArray: string[] = []
910

1011
// serialize filters first, they are handled specially

src/utils/paramsSerializer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* @ignore
33
* not part of public api, don't include in generated docs
44
*/
5-
export default function ParamSerializer(params: {
5+
export default function ParamSerializer(originalParams: {
66
[key: string]: any
77
}): string {
8+
const params = JSON.parse(JSON.stringify(originalParams)) // don't mutate original object
89
const valuesArray: string[] = []
910

1011
// serialize filters first, they are handled specially

0 commit comments

Comments
 (0)