From d48f22b8dc618e19b12418ac01f3dd0f369ac655 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Wed, 8 Dec 2021 04:25:28 -0800 Subject: [PATCH] Factor out GK fetch logic Summary: Removed loadGKs and loadDistilleryGKs from the `flipper` API, as it leaked implementation details of GK that didn't work well with decapitation later in this diff, and refactored it to using `getFlipperLib().GK`. After that discovered that those APIs are actuallly only used by nt-shared's performGKcheck, which was already removed from all usages in D27736036, so just removed the code altogether. But left loading distillery GKs in place, since that is good infra structure to provide anyway(?), although we don't have active use cases atm Reviewed By: jknoxville Differential Revision: D32529600 fbshipit-source-id: a03fb14ada21018d329eea78a59f1b20610b2fd3 --- desktop/flipper-ui-core/src/deprecated-exports.tsx | 1 - desktop/plugins/public/hermesdebuggerrn/Banner.tsx | 7 ++++--- desktop/plugins/public/layout/index.tsx | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/desktop/flipper-ui-core/src/deprecated-exports.tsx b/desktop/flipper-ui-core/src/deprecated-exports.tsx index 982142f3c..727d1d2e9 100644 --- a/desktop/flipper-ui-core/src/deprecated-exports.tsx +++ b/desktop/flipper-ui-core/src/deprecated-exports.tsx @@ -14,7 +14,6 @@ export {produce} from 'immer'; export * from './ui/index'; export {textContent, sleep} from 'flipper-plugin'; export * from './utils/jsonTypes'; -export {default as GK, loadGKs, loadDistilleryGK} from './fb-stubs/GK'; export {default as createPaste} from './fb-stubs/createPaste'; export { internGraphGETAPIRequest, diff --git a/desktop/plugins/public/hermesdebuggerrn/Banner.tsx b/desktop/plugins/public/hermesdebuggerrn/Banner.tsx index fc01d36da..dc9a42f99 100644 --- a/desktop/plugins/public/hermesdebuggerrn/Banner.tsx +++ b/desktop/plugins/public/hermesdebuggerrn/Banner.tsx @@ -8,8 +8,9 @@ */ import React from 'react'; -import {styled, colors, FlexRow, Text, GK} from 'flipper'; +import {styled, colors, FlexRow, Text} from 'flipper'; import {Typography} from 'antd'; +import {getFlipperLib} from 'flipper-plugin'; const BannerContainer = styled(FlexRow)({ height: '30px', @@ -51,11 +52,11 @@ function CustomLink(props: { } export const isBannerEnabled: () => boolean = function () { - return GK.get('flipper_plugin_hermes_debugger_survey'); + return getFlipperLib().GK('flipper_plugin_hermes_debugger_survey'); }; export default function Banner() { - if (!GK.get('flipper_plugin_hermes_debugger_survey')) { + if (!getFlipperLib().GK('flipper_plugin_hermes_debugger_survey')) { return null; } return ( diff --git a/desktop/plugins/public/layout/index.tsx b/desktop/plugins/public/layout/index.tsx index 8f6f2a41b..db8beb2c2 100644 --- a/desktop/plugins/public/layout/index.tsx +++ b/desktop/plugins/public/layout/index.tsx @@ -16,7 +16,6 @@ import { Toolbar, DetailSidebar, Button, - GK, Idler, ReduxState, ArchivedDevice, @@ -36,6 +35,7 @@ import { IDEType, } from 'flipper'; import {message} from 'antd'; +import {getFlipperLib} from 'flipper-plugin'; type State = { init: boolean; @@ -463,7 +463,9 @@ export default class LayoutPlugin extends FlipperPlugin< ) : null; - const showAnalyzeYogaPerformanceButton = GK.get('flipper_yogaperformance'); + const showAnalyzeYogaPerformanceButton = getFlipperLib().GK( + 'flipper_yogaperformance', + ); if (!this.state.init) { return null;