InteractiveAdvertisingBureau/iabtcf-es

GVL object is being constructed with the gvl json, and setting consentLanguage forces another fetch

mguerra10128 opened this issue · 1 comments

Version
1.5.6

Module (core, cmpapi, cli, stub, or testing)
core

Describe with reproduction steps – What is the expected behavior?

Please see #341 which was closed, however not resolved.

When using the iab core library server side, and passing gvlJson into constructor, a fetch call is made and results in 'GVLError: unable to load language: XMLHttpRequest is not defined'.

Expected behavior for performance reasons is to avoid call to fetch since it should not be needed

E.g is how we are constructing the GVL object and Model. Btw, we are directly setting tcModel.gvl.lang_ to consent language since this was required for the consentLanguage to get properly encoded into the tc string.
const gvlJson = await vendorListDao.getGlobalVendorList(); // cached version of global vendor list
const gvl = new GVL(gvlJson);
..
tcModel.gvl.lang_ = 'DE';

Refer to for further discussion and detail -
#341
#211 (comment)

Both issues were closed however never resolved. Can a fix be put in to simply be able to set the consentLanguage either on the GVL obj or on the TCModel without it having to do a fetch (since this is not needed). Comment from the other closed issue below

"Calling changeLanguage makes GVL pull another Translation which I don't want. I'm passing the Vendorlist manually through the constructor. .. we don't need GVL to manage the translations and its internal language cache."

@sevriugin another issue that will require your attention if you have time.