Reload instead of restart to apply plugin changes

Summary:
Now full restart is not required for applying plugin changes (install/uninstall/update). So this diff changes the behavior to use reload instead of restart in Plugin Manager and Auto Update Manager. It is much faster than full restart.

Changelog: faster reload after plugin install/uninstall/update.

Reviewed By: jknoxville

Differential Revision: D23706701

fbshipit-source-id: b2dcaf7768a5d47b3c967c17e090fa74884b3850
This commit is contained in:
Anton Nikolaev
2020-09-17 03:05:06 -07:00
committed by Facebook GitHub Bot
parent df0508e826
commit 16a640b7ee
2 changed files with 14 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ import {
import React, {useCallback, useState, useEffect} from 'react'; import React, {useCallback, useState, useEffect} from 'react';
import {List} from 'immutable'; import {List} from 'immutable';
import {reportPlatformFailures, reportUsage} from '../../utils/metrics'; import {reportPlatformFailures, reportUsage} from '../../utils/metrics';
import restartFlipper from '../../utils/restartFlipper'; import reloadFlipper from '../../utils/reloadFlipper';
import {registerInstalledPlugins} from '../../reducers/pluginManager'; import {registerInstalledPlugins} from '../../reducers/pluginManager';
import { import {
UpdateResult, UpdateResult,
@@ -124,7 +124,7 @@ const PluginInstaller = function ({
const rows = useNPMSearch(query, onInstall, installedPlugins); const rows = useNPMSearch(query, onInstall, installedPlugins);
const restartApp = useCallback(() => { const restartApp = useCallback(() => {
restartFlipper(); reloadFlipper();
}, []); }, []);
return ( return (
@@ -132,8 +132,7 @@ const PluginInstaller = function ({
<Container> <Container>
{restartRequired && ( {restartRequired && (
<RestartBar onClick={restartApp}> <RestartBar onClick={restartApp}>
To activate this plugin, Flipper needs to restart. Click here to To apply the changes, Flipper needs to reload. Click here to reload!
restart!
</RestartBar> </RestartBar>
)} )}
<Toolbar> <Toolbar>

View File

@@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {remote} from 'electron';
export default () => remote.getCurrentWindow().reload();