From f2da075accbfc85c2f3c9aaa396d59b9d1e8049c Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 23 Mar 2020 06:42:08 -0700 Subject: [PATCH] Fixed circular dependencies Summary: Fixed circular dependency warnings and removed some dead code while at it. Reviewed By: jknoxville Differential Revision: D20557313 fbshipit-source-id: 856c42113a9abe36d3e14f9d538eb40705ceb87f --- desktop/app/src/reducers/connections.tsx | 13 +++++++++---- desktop/app/src/reducers/supportForm.tsx | 5 +++-- .../ui/components/elements-inspector/Visualizer.tsx | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/desktop/app/src/reducers/connections.tsx b/desktop/app/src/reducers/connections.tsx index 7a5a2fb29..33e00643a 100644 --- a/desktop/app/src/reducers/connections.tsx +++ b/desktop/app/src/reducers/connections.tsx @@ -466,10 +466,15 @@ export const selectDevice = (payload: BaseDevice): Action => ({ payload, }); -export const setStaticView = (payload: StaticView): Action => ({ - type: 'SET_STATIC_VIEW', - payload, -}); +export const setStaticView = (payload: StaticView): Action => { + if (!payload) { + throw new Error('Cannot set empty static view'); + } + return { + type: 'SET_STATIC_VIEW', + payload, + }; +}; export const preferDevice = (payload: string): Action => ({ type: 'PREFER_DEVICE', diff --git a/desktop/app/src/reducers/supportForm.tsx b/desktop/app/src/reducers/supportForm.tsx index aedfd275c..59441e6e6 100644 --- a/desktop/app/src/reducers/supportForm.tsx +++ b/desktop/app/src/reducers/supportForm.tsx @@ -9,7 +9,6 @@ import {Actions, Store} from './'; import {setStaticView} from './connections'; -import SupportRequestFormV2 from '../fb-stubs/SupportRequestFormV2'; import {deconstructClientId} from '../utils/clientUtils'; import {starPlugin as setStarPlugin} from './connections'; import {showStatusUpdatesForDuration} from '../utils/promiseTimeout'; @@ -114,7 +113,9 @@ export class Group { source: 'deeplink', group: this.name, }); - store.dispatch(setStaticView(SupportRequestFormV2)); + store.dispatch( + setStaticView(require('../fb-stubs/SupportRequestFormV2').default), + ); const selectedApp = store.getState().connections.selectedApp; const selectedClient = store.getState().connections.clients.find(o => { return o.id === store.getState().connections.selectedApp; diff --git a/desktop/app/src/ui/components/elements-inspector/Visualizer.tsx b/desktop/app/src/ui/components/elements-inspector/Visualizer.tsx index f3c399241..b8d0088d1 100644 --- a/desktop/app/src/ui/components/elements-inspector/Visualizer.tsx +++ b/desktop/app/src/ui/components/elements-inspector/Visualizer.tsx @@ -9,7 +9,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import {Element, styled} from '../../../ui'; +import {Element} from './ElementsInspector'; +import styled from '@emotion/styled'; export function VisualizerPortal(props: { container: HTMLElement;