Issue when accessing same config key declared both in global config and bidder specific config
Type of issue
Bug
Description
When using config API, keys that are present both at global level and at bidder specific level are not properly deeply merged. This may happen particularly for standardize first party data, as it may involve config with several depth level.
Steps to reproduce
// global config
pbjs.setConfig({
fpd: {
context: {
keywords: ["power tools"],
}
}
});
// bidder specific config
pbjs.setBidderConfig({
bidders: ['criteo'],
config: {
fpd: {
context: {
data: {
category: "tools"
}
}
}
}
});
Expected results
When using config.getConfig('fpd.context'), I'd expect to get the following :
keywords: ["power tools"],
data: {
category: "tools"
}
Actual results
I'm getting the following :
data: {
category: "tools"
}
Other information
This is due to the following line in config.js :
memo[topic] = Object.assign({}, config[topic], currBidderConfig[topic]);
Object.assign does not properly merge objects on all their depths. I'd suggest to replace this line by a function that will properly do a deep merge. PR to come in a few minutes
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.