From d1ccb9e7f29238d971024e604665f7a3349f5b4d Mon Sep 17 00:00:00 2001 From: Orlando Hohmeier Date: Thu, 11 Feb 2016 15:12:37 +0100 Subject: [PATCH] Provide the current React instance via plugin loader Inject/provide the current React instance via the plugin loader. Plugins need to use interface as well as the provided React instance to provide components. Using a different React instance will result in "Invariant Violation" errors. --- src/js/plugin/PluginLoader.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/plugin/PluginLoader.js b/src/js/plugin/PluginLoader.js index 2aaf21d2f..4684f9651 100644 --- a/src/js/plugin/PluginLoader.js +++ b/src/js/plugin/PluginLoader.js @@ -1,3 +1,5 @@ +import React from "react/addons"; + import config from "../config/config"; import URLUtil from "../helpers/URLUtil"; @@ -35,7 +37,10 @@ const PluginLoader = { const pluginDocument = pluginWindow.document; var pluginTimeout = null; - // Inject plugin interface + // Inject the plugin interface including the current React instance. + // Plugins need to use interface as well as the provided React instance + // to provide components. Using a different React instance will result + // in "Invariant Violation" errors. pluginWindow.marathonPluginInterface = Object.freeze({ PluginActions: PluginActions, PluginDispatcher: PluginDispatcherProxy.create(pluginId), @@ -43,6 +48,7 @@ const PluginLoader = { PluginHelper: PluginHelper.create(pluginId), PluginMountPoints: PluginMountPoints, pluginId: pluginId, + React: React, UIVersion: config.version });