Problem/Motivation

countdown.js is loaded on the settings page and tries to read drupalSettings.countdownClock.endTimestamp. Since countdownClock is not defined on that page, the script can throw an error similar to:

Uncaught TypeError: Cannot read properties of undefined (reading 'endTimestamp')
    at Object.attach (countdown.js?v=1.x:5:56)
    at drupal.js?v=11.4.2:166:24
    at Array.forEach (<anonymous>)
    at Object.attachBehaviors (drupal.js?v=11.4.2:162:34)
    at drupal.init.js?v=11.4.2:32:12
    at HTMLDocument.listener (drupal.init.js?v=11.4.2:20:7)

Steps to reproduce

1. Install Drupal 11.4.
2. Enable countdown_clock.
3. Go to /admin/config/countdown-clock.
4. Open the browser developer console.

Proposed resolution

Do not attach countdown_clock/countdown_script to the settings form unless the
form needs a live preview and also attaches the required drupalSettings.
Alternatively, make countdown.js guard against missing settings:

if (!drupalSettings.countdownClock || !drupalSettings.countdownClock.endTimestamp) {
  return;
}

Comments

dkmishra created an issue.