Update plugin store after installation
Summary: Address the small regression introduced by D18173166. When closing the plugin manager after installing/removing, the store wasn't updated in between. Reviewed By: jknoxville Differential Revision: D18270821 fbshipit-source-id: 4ff54bc7607d06fa423cf8e673f216ae0a5d19da
This commit is contained in:
committed by
Facebook Github Bot
parent
432bb1b00a
commit
d2dfb924fd
@@ -20,7 +20,7 @@ import {
|
||||
|
||||
export const PLUGIN_DIR = path.join(homedir(), '.flipper', 'thirdparty');
|
||||
|
||||
async function getInstalledPlugins(): Promise<PluginMap> {
|
||||
export async function readInstalledPlugins(): Promise<PluginMap> {
|
||||
const pluginDirExists = await fs.pathExists(PLUGIN_DIR);
|
||||
|
||||
if (!pluginDirExists) {
|
||||
@@ -50,8 +50,15 @@ async function getInstalledPlugins(): Promise<PluginMap> {
|
||||
return new Map(plugins.filter(Boolean));
|
||||
}
|
||||
|
||||
export default (store: Store, _logger: Logger) => {
|
||||
getInstalledPlugins().then(plugins =>
|
||||
function refreshInstalledPlugins(store: Store) {
|
||||
readInstalledPlugins().then(plugins =>
|
||||
store.dispatch(registerInstalledPlugins(plugins)),
|
||||
);
|
||||
}
|
||||
|
||||
export default (store: Store, _logger: Logger) => {
|
||||
// This needn't happen immediately and is (light) I/O work.
|
||||
window.requestIdleCallback(() => {
|
||||
refreshInstalledPlugins(store);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user