Use selectors to compute plugin lists according to the selected device and app

Summary: Use selectors to re-compute and cache plugin lists according to the selected device and app.

Reviewed By: mweststrate

Differential Revision: D29247845

fbshipit-source-id: 4bc669d5d441d605c4090086c4ce59b6d9684a4c
This commit is contained in:
Anton Nikolaev
2021-06-29 13:00:18 -07:00
committed by Facebook GitHub Bot
parent 1d26faeacb
commit ff5d8ba29f
20 changed files with 294 additions and 358 deletions

View File

@@ -13,7 +13,6 @@ import {ShareType} from '../reducers/application';
import {State as Store} from '../reducers';
import {ActiveSheet} from '../reducers/application';
import {selectedPlugins as actionForSelectedPlugins} from '../reducers/plugins';
import {getExportablePlugins} from '../utils/pluginUtils';
import {
ACTIVE_SHEET_SHARE_DATA,
setActiveSheet as getActiveSheetAction,
@@ -23,6 +22,7 @@ import ListView from './ListView';
import {Dispatch, Action} from 'redux';
import {unsetShare} from '../reducers/application';
import {FlexColumn, styled} from '../ui';
import {getExportablePlugins} from '../selectors/connections';
type OwnProps = {
onHide: () => void;
@@ -104,14 +104,7 @@ class ExportDataPluginSheet extends Component<Props, {}> {
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
(state) => {
const selectedClient = state.connections.clients.find((o) => {
return o.id === state.connections.selectedApp;
});
const availablePluginsToExport = getExportablePlugins(
state,
state.connections.selectedDevice ?? undefined,
selectedClient,
);
const availablePluginsToExport = getExportablePlugins(state);
return {
share: state.application.share,
selectedPlugins: state.plugins.selectedPlugins,