Fix search by passing query to search request (#2377)

Summary:
When publishing a new flipper plugin, I realized my plugin wasn't showing up in the Plugin Installer search. This was due to a bug where we are only grabbing 50 plugins from NPM and filtering through them locally, instead of passing the search term to the search query. There are 59 plugins that match the keyword filter on npm so 9 plugins never get surfaced.

## Changelog

Fix missing plugins in plugin manager's NPM search

Pull Request resolved: https://github.com/facebook/flipper/pull/2377

Test Plan:
Test the search feature in Plugin Manager

Search for the previously missing package:
![image](https://user-images.githubusercontent.com/1904616/119906244-b4daa580-bf02-11eb-8545-c8cf0663ae92.png)

Previously working searches continue to work:
![image](https://user-images.githubusercontent.com/1904616/119906274-c02dd100-bf02-11eb-938a-d84b27c6bd81.png)

Reviewed By: nikoant

Differential Revision: D28831054

Pulled By: passy

fbshipit-source-id: 84442459cd760c3f593b3df5bb3d89d51852e1c4
This commit is contained in:
Arthur Lee
2021-06-02 05:47:03 -07:00
committed by Facebook GitHub Bot
parent b0b49e1098
commit 80feff1615

View File

@@ -35,7 +35,7 @@ export async function getUpdatablePlugins(
): Promise<UpdatablePluginDetails[]> { ): Promise<UpdatablePluginDetails[]> {
const installedPlugins = await getInstalledPlugins(); const installedPlugins = await getInstalledPlugins();
const npmHostedPlugins = new Map<string, NpmPackageDescriptor>( const npmHostedPlugins = new Map<string, NpmPackageDescriptor>(
(await getNpmHostedPlugins()).map((p) => [p.name, p]), (await getNpmHostedPlugins({query})).map((p) => [p.name, p]),
); );
const annotatedInstalledPlugins = await pmap( const annotatedInstalledPlugins = await pmap(
installedPlugins, installedPlugins,