Skip to content

Commit

Permalink
Provide the current React instance via plugin loader
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Orlando Hohmeier committed Feb 11, 2016
1 parent 691ebdd commit d1ccb9e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/js/plugin/PluginLoader.js
@@ -1,3 +1,5 @@
import React from "react/addons";

import config from "../config/config";

import URLUtil from "../helpers/URLUtil";
Expand Down Expand Up @@ -35,14 +37,18 @@ 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),
PluginEvents: PluginEvents,
PluginHelper: PluginHelper.create(pluginId),
PluginMountPoints: PluginMountPoints,
pluginId: pluginId,
React: React,
UIVersion: config.version
});

Expand Down

0 comments on commit d1ccb9e

Please sign in to comment.