From ca8df6d680883e3b8c81780cfc21e9089fb2df22 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 8 Oct 2019 00:17:23 -0700 Subject: [PATCH] Remove "no file" error dialog Summary: This is a programming error, not something that users should ever be exposed to. This logs an error instead and just doesn't show anything. The big benefit is that the component no longer needs to deal with `file` potentially being undefined. Reviewed By: jknoxville Differential Revision: D17786913 fbshipit-source-id: 32a357381e64cd9237ad4a0112c346d7121634ef --- src/App.tsx | 13 +++++++------ src/chrome/ShareSheetExportFile.tsx | 21 +-------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index d505e2f52..0773afc35 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -97,16 +97,17 @@ export class App extends React.Component { ); case ACTIVE_SHEET_SHARE_DATA_IN_FILE: - return ( + return this.props.share && this.props.share.type === 'file' ? ( + ) : ( + (() => { + console.error('No file provided when calling share sheet.'); + return null; + })() ); case ACTIVE_SHEET_PLUGIN_SHEET: // Currently unused. diff --git a/src/chrome/ShareSheetExportFile.tsx b/src/chrome/ShareSheetExportFile.tsx index bc42bb4ce..3c85b0b14 100644 --- a/src/chrome/ShareSheetExportFile.tsx +++ b/src/chrome/ShareSheetExportFile.tsx @@ -50,7 +50,7 @@ const InfoText = styled(Text)({ type Props = { onHide: () => void; - file: string | null; + file: string; logger: Logger; }; @@ -202,9 +202,6 @@ export default class ShareSheetExportFile extends Component { } render() { - if (!this.props.file) { - return this.renderNoFileError(this.context); - } const {result, statusUpdate} = this.state; switch (result.kind) { case 'success': @@ -215,20 +212,4 @@ export default class ShareSheetExportFile extends Component { return this.renderPending(this.context, statusUpdate); } } - - renderNoFileError(context: any) { - return ( - -
- No file selected -
- - - - -
- ); - } }