Do not update state when the component is unmounted
Summary:
Bug:
{F176561921}
Reviewed By: danielbuechele
Differential Revision: D16763611
fbshipit-source-id: 93b95877f4818a9d2b2c7ba1b27eabaec41d4e95
This commit is contained in:
committed by
Facebook Github Bot
parent
3401d1ef3c
commit
9a513ebd99
@@ -148,6 +148,7 @@ export default class ShareSheet extends Component<Props, State> {
|
||||
}
|
||||
this.props.logger.trackTimeSince(mark, 'export:url-success');
|
||||
} catch (e) {
|
||||
if (!this.state.runInBackground) {
|
||||
const str = e instanceof Error ? e.toString() : e;
|
||||
this.setState({
|
||||
result: {
|
||||
@@ -155,6 +156,7 @@ export default class ShareSheet extends Component<Props, State> {
|
||||
error: str,
|
||||
},
|
||||
});
|
||||
}
|
||||
this.props.logger.trackTimeSince(mark, 'export:url-error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,9 @@ export default class ShareSheetExportFile extends Component<Props, State> {
|
||||
this.setState({errorArray, result: {success: true, error: null}});
|
||||
this.props.logger.trackTimeSince(mark, 'export:file-success');
|
||||
} catch (err) {
|
||||
if (!this.state.runInBackground) {
|
||||
this.setState({errorArray: [], result: {success: false, error: err}});
|
||||
}
|
||||
this.props.logger.trackTimeSince(mark, 'export:file-error');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user