remove setup method in plugins

Summary:
Plugins had their custom setup method which needed to be called externally. That is what consturctors are for. This removes the setup method and moves ths logic to the constructor.
The setup method was called to late which caused the graphQL plugin to crash. With the logic now being in the constructor, it is ensured that it is called at the initialization.

Reviewed By: jknoxville

Differential Revision: D8769807

fbshipit-source-id: 7b4ab4815bbe397c80998adcb89ca361df6970d3
This commit is contained in:
Daniel Büchele
2018-07-10 07:03:53 -07:00
committed by Facebook Github Bot
parent c8c2cfa16f
commit c948e50c10
2 changed files with 22 additions and 35 deletions

View File

@@ -107,7 +107,6 @@ class PluginContainer extends Component<Props, State> {
const {target} = this.state;
if (ref && target) {
activateMenuItems(ref);
ref._setup(target);
ref._init();
this.plugin = ref;
}
@@ -135,6 +134,7 @@ class PluginContainer extends Component<Props, State> {
logger: this.props.logger,
persistedState: pluginStates[pluginKey] || {},
setPersistedState: state => setPluginState({pluginKey, state}),
target,
ref: this.refChanged,
})}
</ErrorBoundary>