Prevent JS errors when form ids absent in drupalSettings

Created on 14 March 2023, almost 2 years ago

I had faced with issues for Views Ajax History, which was solved by wrapping simple recaptcha JS logic by condition that form ids are presented before next processing.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇷🇺Russia kiseleva.t

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kiseleva.t
  • Status changed to Needs review almost 2 years ago
  • 🇷🇺Russia kiseleva.t

    Just wrapped the code by next condition:
    if (typeof drupalSettings.simple_recaptcha !== 'undefined' && typeof drupalSettings.simple_recaptcha.form_ids !== 'undefined') {}
    for v3:
    if (typeof drupalSettings.simple_recaptcha_v3 !== 'undefined' && typeof drupalSettings.simple_recaptcha_v3.forms !== 'undefined') {}

Production build 0.71.5 2024