1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Mobile: Plugin settings screen: Fix plugin states not set correctly when installing multiple plugins at once (#10580)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
Henry Heino
2024-06-14 11:36:44 -07:00
committed by GitHub
parent ce22d8238c
commit 4751b4dd74
6 changed files with 44 additions and 22 deletions

View File

@ -13,7 +13,7 @@ type GetRepoApiCallback = ()=> RepositoryApi;
const useOnInstallHandler = (
setInstallingPluginIds: React.Dispatch<React.SetStateAction<Record<string, boolean>>>,
pluginSettings: PluginSettings,
pluginSettingsRef: React.RefObject<PluginSettings>,
getRepoApi: GetRepoApiCallback|RepositoryApi,
onPluginSettingsChange: OnPluginSettingChangeHandler,
isUpdate: boolean,
@ -45,6 +45,7 @@ const useOnInstallHandler = (
}
if (!installError) {
const pluginSettings = pluginSettingsRef.current;
const newSettings = produce(pluginSettings, (draft: PluginSettings) => {
draft[pluginId] = defaultPluginSetting();
if (isUpdate) {
@ -71,7 +72,7 @@ const useOnInstallHandler = (
{ buttons: [_('OK')] },
);
}
}, [getRepoApi, isUpdate, pluginSettings, onPluginSettingsChange, setInstallingPluginIds]);
}, [getRepoApi, isUpdate, pluginSettingsRef, onPluginSettingsChange, setInstallingPluginIds]);
};
export default useOnInstallHandler;