Describe the bug
When calling removeGlobalContexts the equality statement is backwards, so it removes unexpected schemas.
|
globalPrimitives = globalPrimitives.filter((item) => JSON.stringify(item) === JSON.stringify(context)); |
To Reproduce
window.snowplow('addGlobalContexts', [{
schema: 'iglu:com.snowplowanalytics.snowplow/schema1/jsonschema/1-0-0',
data: {
prop1: 'hello'
}
},
{
schema: 'iglu:com.snowplowanalytics.snowplow/schema2/jsonschema/1-0-0',
data: {
prop2: 'hello2'
}
}]);
window.snowplow('trackPageView');
window.snowplow('removeGlobalContexts', [{
schema: 'iglu:com.snowplowanalytics.snowplow/schema2/jsonschema/1-0-0',
data: {
prop2: 'hello2'
}
}]);
window.snowplow('trackPageView');
Expected behavior
With this, schema1 is removed, when it is expected that schema2 should be removed.
Describe the bug
When calling
removeGlobalContextsthe equality statement is backwards, so it removes unexpected schemas.snowplow-javascript-tracker/libraries/tracker-core/src/contexts.ts
Line 199 in c2e3ccb
To Reproduce
Expected behavior
With this,
schema1is removed, when it is expected thatschema2should be removed.