diff --git a/app/assets/javascripts/discourse/app/widgets/widget.js b/app/assets/javascripts/discourse/app/widgets/widget.js index 5d398aced5e..b4b6d580c1f 100644 --- a/app/assets/javascripts/discourse/app/widgets/widget.js +++ b/app/assets/javascripts/discourse/app/widgets/widget.js @@ -41,7 +41,14 @@ export function deleteFromRegistry(name) { const _decorators = {}; export function decorateWidget(widgetName, cb) { - _decorators[widgetName] = _decorators[widgetName] || []; + if (!_registry[name]) { + // eslint-disable-next-line no-console + console.error( + consolePrefix(), + `decorateWidget: Could not find widget '${name}' in registry` + ); + } + _decorators[widgetName] ??= []; _decorators[widgetName].push(cb); }