1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01: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, currency: fragment.currency,
environmentType: fragment.environmentType, environmentType: fragment.environmentType,
actionId: fragment.actionId, 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(); const { fragments } = this.store.getState();
delete fragments[id]; delete fragments[id];

View File

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