Skip to content

Provide a mergeOptions configuration to pass along to deepmerge #186

@BenLorantfy

Description

@BenLorantfy

Currently, it is impossible to track objects of type Error or objects that inherit from Error. This is because deepmerge treats Error as a mergeable object and creates a plain object with it.
See: https://www.npmjs.com/package/deepmerge#ismergeableobject
and: https://github.com/nytimes/react-tracking/blob/main/src/useTrackingImpl.js#L43

This means Error objects will be converted to plain objects when they reach the custom dispatch function. I assume this isn't intended behaviour?

Would you accept a PR that turns this behaviour off via a configuration value? This would allow the custom dispatch to handle Error objects. Alternatively, this could be turned off by default but that would be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions