diff --git a/app/scripts/controllers/metametrics-controller.ts b/app/scripts/controllers/metametrics-controller.ts index e286a3a47d02..d9a8a1cdefea 100644 --- a/app/scripts/controllers/metametrics-controller.ts +++ b/app/scripts/controllers/metametrics-controller.ts @@ -1,4 +1,5 @@ import { + cloneDeep, isEqual, memoize, merge, @@ -584,7 +585,9 @@ export default class MetaMetricsController extends BaseController< : {}; this.update((state) => { - state.fragments[id] = merge(additionalFragmentProps, fragment); + // We're cloning "additionalFragmentProps" because it can contain a frozen piece of Immer state + // @ts-expect-error this is caused by a bug in Immer, not being able to handle recursive types like Json + state.fragments[id] = merge(cloneDeep(additionalFragmentProps), fragment); }); if (fragment.initialEvent) {