1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

fix issue with fragment messageIds (#17949)

This commit is contained in:
Brad Decker 2023-03-07 09:46:41 -06:00 committed by GitHub
parent 8472ccb7b0
commit d9826e9385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -356,7 +356,14 @@ export default class MetaMetricsController {
currency: fragment.currency,
environmentType: fragment.environmentType,
actionId: fragment.actionId,
uniqueIdentifier: fragment.uniqueIdentifier,
// We append success or failure to the unique-identifier so that the
// messageId can still be idempotent, but so that it differs from the
// initial event fired. The initial event was preventing new events from
// making it to mixpanel because they were using the same unique ID as
// the events processed in other parts of the fragment lifecycle.
uniqueIdentifier: fragment.uniqueIdentifier
? `${fragment.uniqueIdentifier}-${abandoned ? 'failure' : 'success'}`
: undefined,
});
const { fragments } = this.store.getState();
delete fragments[id];

View File

@ -119,6 +119,7 @@ const SAMPLE_NON_PERSISTED_EVENT = {
category: 'Unit Test',
successEvent: 'sample non-persisted event success',
failureEvent: 'sample non-persisted event failure',
uniqueIdentifier: 'sample-non-persisted-event',
properties: {
test: true,
},
@ -175,7 +176,7 @@ describe('MetaMetricsController', function () {
...DEFAULT_EVENT_PROPERTIES,
test: true,
},
messageId: Utils.generateRandomId(),
messageId: 'sample-non-persisted-event-failure',
timestamp: new Date(),
});
const metaMetricsController = getMetaMetricsController();