Fixed re-enabling a still selected plugin
Summary: While testing manually discovered the sandy plugin infra din't cover the case that a plugin can be selected but not enabled at the same time. Added test and fixed that. Reviewed By: nikoant Differential Revision: D22308597 fbshipit-source-id: 6cef2b543013ee81cee449396d523dd9a657ad1c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d16c6061c1
commit
581ddafd18
@@ -149,7 +149,11 @@ export class SandyPluginInstance {
|
||||
|
||||
// the plugin is deselected in the UI
|
||||
deactivate() {
|
||||
this.assertNotDestroyed();
|
||||
if (this.destroyed) {
|
||||
// this can happen if the plugin is disabled while active in the UI.
|
||||
// In that case deinit & destroy is already triggered from the STAR_PLUGIN action
|
||||
return;
|
||||
}
|
||||
const pluginId = this.definition.id;
|
||||
if (!this.realClient.isBackgroundPlugin(pluginId)) {
|
||||
this.realClient.deinitPlugin(pluginId);
|
||||
@@ -174,7 +178,9 @@ export class SandyPluginInstance {
|
||||
|
||||
destroy() {
|
||||
this.assertNotDestroyed();
|
||||
this.disconnect();
|
||||
if (this.connected) {
|
||||
this.realClient.deinitPlugin(this.definition.id);
|
||||
}
|
||||
this.events.emit('destroy');
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user