Call plugin teardown method when plugin is destroyed
Summary: `teardown()` was not called for device plugins. This diff fixes the issue. Reviewed By: jknoxville Differential Revision: D16416440 fbshipit-source-id: 5c9ffa211bfbe4e322504c37b95ff87afab8d061
This commit is contained in:
committed by
Facebook Github Bot
parent
a86ea5131c
commit
5beb4f7b2b
@@ -79,6 +79,13 @@ class PluginContainer extends PureComponent<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.plugin) {
|
||||
this.plugin._teardown();
|
||||
this.plugin = null;
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
pluginState,
|
||||
|
||||
@@ -164,6 +164,10 @@ export class FlipperDevicePlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
|
||||
this.init();
|
||||
}
|
||||
|
||||
_teardown() {
|
||||
this.teardown();
|
||||
}
|
||||
|
||||
static supportsDevice(device: BaseDevice) {
|
||||
throw new Error(
|
||||
'supportsDevice is unimplemented in FlipperDevicePlugin class',
|
||||
|
||||
Reference in New Issue
Block a user