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

@@ -17,10 +17,9 @@ import {addStatusMessage, removeStatusMessage} from './application';
import constants from '../fb-stubs/constants';
import {getInstance} from '../fb-stubs/Logger';
import {logPlatformSuccessRate} from '../utils/metrics';
import {getExportablePlugins} from '../utils/pluginUtils';
export const SUPPORT_FORM_PREFIX = 'support-form-v2';
import Client from '../Client';
import BaseDevice, {OS} from '../devices/BaseDevice';
import {OS} from '../devices/BaseDevice';
import {getExportablePlugins} from '../selectors/connections';
const {DEFAULT_SUPPORT_GROUP} = constants;
@@ -193,11 +192,7 @@ export class Group {
selectedGroup: this,
}),
);
const pluginsList = getExportablePlugins(
store.getState(),
store.getState().connections.selectedDevice ?? undefined,
selectedClient,
);
const pluginsList = getExportablePlugins(store.getState());
store.dispatch(
setSelectedPlugins(
@@ -220,10 +215,8 @@ export class Group {
getWarningMessage(
state: Parameters<typeof getExportablePlugins>[0],
device: BaseDevice | undefined,
client: Client,
): string | null {
const activePersistentPlugins = getExportablePlugins(state, device, client);
const activePersistentPlugins = getExportablePlugins(state);
const emptyPlugins: Array<string> = [];
for (const plugin of this.requiredPlugins) {
if (