Skip to content

Commit 6496fc2

Browse files
committed
use array overwrite merge strategy
this prevents stale data being supplied for endpoint attributes
1 parent 3bb256a commit 6496fc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/analytics.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const getMetrics = (extra = {}) =>
122122
...carry,
123123
[name]: Number(typeof value === 'function' ? value() : value),
124124
}), {});
125+
const overwriteMerge = (destinationArray, sourceArray) => sourceArray;
125126

126127
/**
127128
* Initialise cognito services.
@@ -273,7 +274,9 @@ const Analytics = {
273274
}
274275

275276
// Merge new endpoint data with defaults.
276-
endpoint = merge.all([EndpointData, Existing, endpoint]);
277+
endpoint = merge.all([EndpointData, Existing, endpoint], {
278+
arrayMerge: overwriteMerge
279+
});
277280

278281
// Store the endpoint data.
279282
Analytics.setEndpoint(endpoint);

0 commit comments

Comments
 (0)