apollographql / datasource-rest

A caching data source for REST APIs
MIT License
39 stars 20 forks source link

use lodash cloneDeep to clone parsed body #270

Closed Sean-Y-X closed 1 year ago

Sean-Y-X commented 1 year ago

JSON.parse(JSON.stringify()) is a bad way to clone objects.

There are many reasons why it is bad. For example: why-json-parse-json-stringify-is-a-bad-practice-to-clone-an-object-in-javascript

I understand this method can be overridden but I don't think we should use a flawed approach as the default.

apollo-cla commented 1 year ago

@Sean-Y-X: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Sean-Y-X commented 1 year ago

@trevor-scheer thanks for your suggestions!