Skip to content

Commit

Permalink
Merge pull request #1124 from City-of-Helsinki/UHF-X_undefined_to_object
Browse files Browse the repository at this point in the history
Prevent massive amount of sentry javascript errors
  • Loading branch information
rpnykanen authored Dec 4, 2024
2 parents 8675344 + db00453 commit 293ec5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/embedded-content-cookie-compliance.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/js/embedded-content-cookie-compliance.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
(function ($, Drupal, drupalSettings) {

const loadEmbeddedContent = () => {
if (Drupal.cookieConsent.getConsentStatus(['preferences', 'statistics'])) {
if (
Drupal.cookieConsent.getConsentStatus(['preferences', 'statistics']) &&
drupalSettings.embedded_media_attributes
) {
// eslint-disable-next-line no-restricted-syntax
for (const [id, attributes] of Object.entries(drupalSettings.embedded_media_attributes)) {
const iframeElement = document.createElement('iframe');
Expand Down

0 comments on commit 293ec5e

Please sign in to comment.