Use set instead of array to keep list of supported plugins per client

Summary: Use set instead of array to keep list of supported plugins per client. It is not used as array anyway, in most places it is used to determine whether a plugin is supported or not and it's much faster to use set for that.

Reviewed By: priteshrnandgaonkar

Differential Revision: D29200673

fbshipit-source-id: 5f3c404a1a668c153867d7c1b6c223941f0b3b36
This commit is contained in:
Anton Nikolaev
2021-06-29 13:00:18 -07:00
committed by Facebook GitHub Bot
parent 280c612157
commit fd9b5cc94d
14 changed files with 51 additions and 55 deletions

View File

@@ -417,10 +417,7 @@ class PluginContainer extends PureComponent<Props, State> {
selectPlugin: (pluginID: string, deepLinkPayload: unknown) => {
const {target} = this.props;
// check if plugin will be available
if (
target instanceof Client &&
target.plugins.some((p) => p === pluginID)
) {
if (target instanceof Client && target.plugins.has(pluginID)) {
this.props.selectPlugin({
selectedPlugin: pluginID,
deepLinkPayload,