amplitude / Amplitude-JavaScript

JavaScript SDK for Amplitude
MIT License
315 stars 132 forks source link

fix: nested object in options are shared across multiple instances #559

Closed kevinpagtakhan closed 1 year ago

kevinpagtakhan commented 1 year ago

Summary

Creates clone of nested objects in DEFAULT_OPTIONS to break sharing of references to these nested objects

Testing

const a = amplitude.getInstance('a')
> undefined
const a = amplitude.getInstance('a')
> undefined
a.options.plan === b.options.plan
> false
a.options.library === b.options.library
> false
a.options.headers === b.options.headers
> false
a.options.ingestionMetadata === b.options.ingestionMetadata
> false

Checklist