Fix installed plugin check
Summary: D17877108 inadvertently introduced a bug because `fs` and `fs-extra` behave differently and apparently wrapping `exists` which is already async in another `promisify` ends up raising the result as an exception (in this case throwing "true" or "false" as an error instead of yielding it back). Annoyingly, TypeScript's type system doesn't catch this. :/ This fixes the invocation and restores the install/remove functionality. Reviewed By: jknoxville Differential Revision: D18199958 fbshipit-source-id: f5835d8912bfe1191a12a318103bfc1fb7d776a3
This commit is contained in:
committed by
Facebook Github Bot
parent
93fad01ea5
commit
4c47c766fd
@@ -26,12 +26,10 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'flipper';
|
} from 'flipper';
|
||||||
import React, {useCallback, useState, useMemo, useEffect} from 'react';
|
import React, {useCallback, useState, useMemo, useEffect} from 'react';
|
||||||
import {remote} from 'electron';
|
|
||||||
import {List} from 'immutable';
|
import {List} from 'immutable';
|
||||||
import algoliasearch from 'algoliasearch';
|
import algoliasearch from 'algoliasearch';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import {promisify} from 'util';
|
|
||||||
import {homedir} from 'os';
|
import {homedir} from 'os';
|
||||||
import {PluginManager as PM} from 'live-plugin-manager';
|
import {PluginManager as PM} from 'live-plugin-manager';
|
||||||
import {reportPlatformFailures, reportUsage} from '../utils/metrics';
|
import {reportPlatformFailures, reportUsage} from '../utils/metrics';
|
||||||
@@ -368,7 +366,7 @@ function useNPMSearch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function _getInstalledPlugins(): Promise<Map<string, PluginDefinition>> {
|
async function _getInstalledPlugins(): Promise<Map<string, PluginDefinition>> {
|
||||||
const pluginDirExists = await promisify(fs.exists)(PLUGIN_DIR);
|
const pluginDirExists = await fs.pathExists(PLUGIN_DIR);
|
||||||
|
|
||||||
if (!pluginDirExists) {
|
if (!pluginDirExists) {
|
||||||
return new Map();
|
return new Map();
|
||||||
|
|||||||
Reference in New Issue
Block a user