diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index 140cb5f7eac..5ca85473c5b 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -137,7 +137,7 @@ const Discourse = Ember.Application.extend({ Discourse.instanceInitializer({ name: "_discourse_plugin_" + (++initCount), after: 'inject-objects', - initialize: function() { + initialize() { withPluginApi(cb.version, cb.code); } }); diff --git a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 index 7419562b747..b8beb0020d9 100644 --- a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 +++ b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 @@ -361,6 +361,11 @@ function getPluginApi(version) { if (!_pluginv01) { _pluginv01 = new PluginApi(version, Discourse.__container__); } + + // We are recycling the compatible object, but let's update to the higher version + if (_pluginv01.version < version) { + _pluginv01.version = version; + } return _pluginv01; } else { console.warn(`Plugin API v${version} is not supported`);