so i had this bug in my code, when my function didn't return object with traslations for ConsentModal. Which led to state._currentTranslation.consentModal be undefined and function createConsentModal did not create any html elements. This led to unrelated errors about missing dom elements. CookieConsent was trying add events and attributes even, when props like dom._cm where undefined.
Proposed solution
In createConsentModal should be atleast console.warn or throw?
const createConsentModal = (api, createMainContainer) => {
// ...
/**
* @type {import("../global").ConsentModalOptions}
*/
const consentModalData = state._currentTranslation && state._currentTranslation.consentModal;
if (!consentModalData) {
// console.warn('consentModalData is undefined');
// throw new Error('consentModalData is undefined');
return;
}
// ...
Description
Hello,
so i had this bug in my code, when my function didn't return object with traslations for ConsentModal. Which led to
state._currentTranslation.consentModal
be undefined and functioncreateConsentModal
did not create any html elements. This led to unrelated errors about missing dom elements. CookieConsent was trying add events and attributes even, when props likedom._cm
where undefined.Proposed solution
In
createConsentModal
should be atleastconsole.warn
or throw?Additional details
No response