diff --git a/desktop/flipper-common/src/server-types.tsx b/desktop/flipper-common/src/server-types.tsx index e28467b97..102977aa0 100644 --- a/desktop/flipper-common/src/server-types.tsx +++ b/desktop/flipper-common/src/server-types.tsx @@ -207,6 +207,7 @@ const environmentVariables = { FLIPPER_NO_PLUGIN_MARKETPLACE: 1, HOME: 1, METRO_PORT_ENV_VAR: 1, + FLIPPER_PLUGIN_AUTO_UPDATE_POLLING_INTERVAL: 1, } as const; export type ENVIRONMENT_VARIABLES = keyof typeof environmentVariables; diff --git a/desktop/flipper-common/src/settings.tsx b/desktop/flipper-common/src/settings.tsx index 868c988a6..9b55b4c82 100644 --- a/desktop/flipper-common/src/settings.tsx +++ b/desktop/flipper-common/src/settings.tsx @@ -77,7 +77,7 @@ export type EnvironmentInfo = { appVersion: string; os: { arch: string; - platform: string; + platform: NodeJS.Platform; unixname: string; }; versions: { diff --git a/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx b/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx index ef84a2f20..ce3eef431 100644 --- a/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx +++ b/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx @@ -201,7 +201,10 @@ async function verifyLighthouseAndUserLoggedIn( store: Store, title: string, ): Promise { - if (!getFlipperLib().isFB || process.env.NODE_ENV === 'test') { + if ( + !getFlipperLib().isFB || + getRenderHostInstance().serverConfig.env.NODE_ENV === 'test' + ) { return true; // ok, continue } diff --git a/desktop/flipper-ui-core/src/dispatcher/plugins.tsx b/desktop/flipper-ui-core/src/dispatcher/plugins.tsx index ab8a0997a..850575d19 100644 --- a/desktop/flipper-ui-core/src/dispatcher/plugins.tsx +++ b/desktop/flipper-ui-core/src/dispatcher/plugins.tsx @@ -107,7 +107,10 @@ export default async (store: Store, _logger: Logger) => { const classicPlugins = initialPlugins.filter( (p) => !isSandyPlugin(p.details), ); - if (process.env.NODE_ENV !== 'test' && classicPlugins.length) { + if ( + getRenderHostInstance().serverConfig.env.NODE_ENV !== 'test' && + classicPlugins.length + ) { console.warn( `${ classicPlugins.length @@ -154,7 +157,7 @@ export function getLatestCompatibleVersionOfEachPlugin< } async function getBundledPlugins(): Promise> { - if (process.env.NODE_ENV === 'test') { + if (getRenderHostInstance().serverConfig.env.NODE_ENV === 'test') { return []; } try { diff --git a/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx b/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx index 76f4f6f11..c1be6d0a9 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/LeftRail.tsx @@ -66,6 +66,7 @@ import { } from '../utils/exportData'; import {openDeeplinkDialog} from '../deeplink'; import {css} from '@emotion/css'; +import {getRenderHostInstance} from '../RenderHost'; const LeftRailButtonElem = styled(Button)<{kind?: 'small'}>(({kind}) => ({ width: kind === 'small' ? 32 : 36, @@ -300,7 +301,12 @@ function ExtrasMenu() { {showSettings && ( - + )} ( - + )); } diff --git a/desktop/flipper-ui-core/src/ui/components/searchable/Searchable.tsx b/desktop/flipper-ui-core/src/ui/components/searchable/Searchable.tsx index 270c3b6bb..80266d336 100644 --- a/desktop/flipper-ui-core/src/ui/components/searchable/Searchable.tsx +++ b/desktop/flipper-ui-core/src/ui/components/searchable/Searchable.tsx @@ -20,6 +20,7 @@ import {debounce} from 'lodash'; import ToggleButton from '../ToggleSwitch'; import React from 'react'; import {Layout, theme, Toolbar} from 'flipper-plugin'; +import {getRenderHostInstance} from '../../../RenderHost'; const SearchBar = styled(Toolbar)({ height: 42, @@ -298,9 +299,11 @@ export default function Searchable( }; onKeyDown = (e: KeyboardEvent) => { + const {platform} = + getRenderHostInstance().serverConfig.environmentInfo.os; const ctrlOrCmd = (e: KeyboardEvent) => - (e.metaKey && process.platform === 'darwin') || - (e.ctrlKey && process.platform !== 'darwin'); + (e.metaKey && platform === 'darwin') || + (e.ctrlKey && platform !== 'darwin'); if (e.key === 'f' && ctrlOrCmd(e) && this._inputRef) { e.preventDefault(); diff --git a/desktop/flipper-ui-core/src/ui/components/table/ManagedTable.tsx b/desktop/flipper-ui-core/src/ui/components/table/ManagedTable.tsx index 90af61e01..98dca200b 100644 --- a/desktop/flipper-ui-core/src/ui/components/table/ManagedTable.tsx +++ b/desktop/flipper-ui-core/src/ui/components/table/ManagedTable.tsx @@ -32,6 +32,7 @@ import {debounce} from 'lodash'; import {DEFAULT_ROW_HEIGHT} from './types'; import {notNull} from '../../../utils/typeUtils'; import {getFlipperLib, textContent} from 'flipper-plugin'; +import {getRenderHostInstance} from '../../../RenderHost'; const EMPTY_OBJECT = {}; Object.freeze(EMPTY_OBJECT); @@ -328,12 +329,13 @@ export class ManagedTable extends React.Component< onKeyDown = (e: React.KeyboardEvent) => { const {highlightedRows} = this.state; + const {platform} = getRenderHostInstance().serverConfig.environmentInfo.os; if (highlightedRows.size === 0) { return; } if ( - ((e.metaKey && process.platform === 'darwin') || - (e.ctrlKey && process.platform !== 'darwin')) && + ((e.metaKey && platform === 'darwin') || + (e.ctrlKey && platform !== 'darwin')) && e.keyCode === 67 ) { e.stopPropagation(); @@ -421,6 +423,7 @@ export class ManagedTable extends React.Component< if (!this.props.highlightableRows) { return; } + const {platform} = getRenderHostInstance().serverConfig.environmentInfo.os; if (e.shiftKey) { // prevents text selection @@ -430,8 +433,7 @@ export class ManagedTable extends React.Component< let {highlightedRows} = this.state; const contextClick = - e.button !== 0 || - (process.platform === 'darwin' && e.button === 0 && e.ctrlKey); + e.button !== 0 || (platform === 'darwin' && e.button === 0 && e.ctrlKey); if (contextClick) { if (!highlightedRows.has(row.key)) { @@ -445,8 +447,8 @@ export class ManagedTable extends React.Component< document.addEventListener('mouseup', this.onStopDragSelecting); if ( - ((process.platform === 'darwin' && e.metaKey) || - (process.platform !== 'darwin' && e.ctrlKey)) && + ((platform === 'darwin' && e.metaKey) || + (platform !== 'darwin' && e.ctrlKey)) && this.props.multiHighlight ) { highlightedRows.add(row.key);