From 65ff3f8ec9a56bc178e804df526b690fb82aad50 Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Fri, 18 Oct 2019 07:31:21 -0700 Subject: [PATCH] Show support form option for deeplink users Summary: This diff shows the support form option for the deeplink users too even if they are not part of GK. As I discovered a bug where the user opened the Flipper app thru deeplink and then the screen showed temporarily till the device connected and then the default plugin was displayed. In this case there is no way to navigate back to the form. Reviewed By: jknoxville Differential Revision: D17978648 fbshipit-source-id: 23ae3660e499a959733753b49cc987f2e381bf6b --- src/chrome/MainSidebar.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/chrome/MainSidebar.tsx b/src/chrome/MainSidebar.tsx index 4f9f2cbe9..e8a594d61 100644 --- a/src/chrome/MainSidebar.tsx +++ b/src/chrome/MainSidebar.tsx @@ -245,7 +245,22 @@ type DispatchFromProps = { }; type Props = OwnProps & StateFromProps & DispatchFromProps; -class MainSidebar extends PureComponent { +type State = {showSupportForm: boolean}; +class MainSidebar extends PureComponent { + state: State = {showSupportForm: GK.get('flipper_support_requests')}; + static getDerivedStateFromProps(props: Props, state: State) { + if ( + !state.showSupportForm && + props.staticView === SupportRequestFormManager + ) { + // Show SupportForm option even when GK is false and support form is shown. + // That means the user has used deeplink to open support form. + // Once the variable is true, it will be true for the whole session. + return {showSupportForm: true}; + } + return state; + } + render() { const { selectedDevice, @@ -304,7 +319,7 @@ class MainSidebar extends PureComponent { )} - {GK.get('flipper_support_requests') && ( + {this.state.showSupportForm && (