DEV: don't define `_super` when modifying widgets unless the property is a function (#8042)

DEV: don’t define _super when modifying widgets unless the property is a function (#8042)

diff --git a/app/assets/javascripts/discourse/widgets/widget.js.es6 b/app/assets/javascripts/discourse/widgets/widget.js.es6
index 004cce4..6888d66 100644
--- a/app/assets/javascripts/discourse/widgets/widget.js.es6
+++ b/app/assets/javascripts/discourse/widgets/widget.js.es6
@@ -79,7 +79,7 @@ export function reopenWidget(name, opts) {
   Object.keys(opts).forEach(k => {
     let old = existing.prototype[k];
 
-    if (old) {
+    if (old instanceof Function) {
       // Add support for `this._super()` to reopened widgets if the prototype exists in the
       // base object
       existing.prototype[k] = function(...args) {

GitHub sha: 2305a6ff

1 Like