Custom theme modals no longer open

We have a custom theme for discourse that we have not modified in months. Recently, the modals have stopped opening and we get an error of:

Uncaught TypeError: $(...).modal is not a function
    didInsertElement d-modal-body.js:31

Removing the custom theme fixes it.

Our theme does not specifically modify anything to do with modals, as far as I can tell. The latest changes done by Discourse to the file that is throwing an error is here:

But it doesn’t look like something that would have dire consequences to custom themes.

Once again, nothing has changed on our theme, so there is something in our theme that is not compatible with recent changes in Discourse.

Our theme code is stored here: GitHub - RebusFoundation/discourse-rebus-theme

Does anyone have a clue of what could cause that problem?

Looking at your site, I’m seeing an error that precedes the one for the modal. I’m thinking the modal issue might be a side effect of this first error that shows up in the console:

mc-validate.js:195 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
    at Object.getAjaxSubmitUrl (mc-validate.js:195:14)
    at mc-validate.js:351:11
    at mc-validate.js:373:2

The mc-validate.js script is introduced in your theme here.

It might be worth trying to temporarily remove that script to see if it fixes the modal issue. If it does, you’ll likely need to do some digging to understand why the third-party script is failing.

3 Likes