From 906b6a0230a381c1858e46e5348e532f73be0dfb Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Fri, 12 Jun 2020 09:46:40 -0700 Subject: [PATCH] RFC NT Layout sidebar extension Summary: This diff is not meant to land as-is, but instead to generate discussion on how to properly accomplish this. The goal is to add a Layout plugin sidebar extension that displays the NT reduction trace when an NT component is selected. Note this is a feature that exists today (when whitelisted on `reduction_trace_check` GK) via the `SKComponentLayoutDescriptor` API, where we'd include the entire JSON representation on every element and display that in a standard inspector in the sidebar. We have a new metadata system where we only include a metadata id and Flipper can separately request the metadata, which is much more performant. Also, we have an existing `NTReductionTracePanel` component we'd like to use that handles requesting and displaying that information in a much better way. I'd still like to use the `SKComponentLayoutDescriptor` API (or something similar) to have access to that component's metadata id in order to decide whether the panel should appear and of course that id is needed for the panel. This works well right now (see test plan), but as you can see, it's less than ideal in that it needs to look into `Extra Sections` then `Native Templates` to get that information. This might be acceptable for the time being while we think this API through, but I wanted to get input on if we can do better before trying to land. Additional questions: - Why are `SidebarExtensions` exported from the "flipper" module, when they only work with and import from the Layout plugin? - There are two `InspectorSidebar` components - one in the Layout plugin and one in main flipper module [here](https://fburl.com/diffusion/ecg8lhfq) that I don't think is being used? Reviewed By: mweststrate Differential Revision: D21887701 fbshipit-source-id: 23ed19c08b68b4b1115b8cc6af84af9e87e91128 --- desktop/app/src/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/desktop/app/src/index.tsx b/desktop/app/src/index.tsx index 64a557312..301018ca0 100644 --- a/desktop/app/src/index.tsx +++ b/desktop/app/src/index.tsx @@ -44,7 +44,6 @@ export {getPluginKey, getPersistedState} from './utils/pluginUtils'; export {Idler} from './utils/Idler'; export {Store, MiddlewareAPI, State as ReduxState} from './reducers/index'; export {default as BaseDevice} from './devices/BaseDevice'; -export {default as SidebarExtensions} from './fb-stubs/LayoutInspectorSidebarExtensions'; export { DeviceLogListener, DeviceLogEntry, @@ -190,3 +189,6 @@ export {Logger} from './fb-interfaces/Logger'; export {getInstance as getLogger} from './fb-stubs/Logger'; export {callVSCode, getVSCodeUrl} from './utils/vscodeUtils'; export {useLocalStorage} from './utils/useLocalStorage'; + +// Sidebar extensions should be last so they can import anything from here. +export {default as SidebarExtensions} from './fb-stubs/LayoutInspectorSidebarExtensions';