diff --git a/web/app/components/plugins/plugin-item/action.tsx b/web/app/components/plugins/plugin-item/action.tsx index 383e00bf55..89b6f2ac3e 100644 --- a/web/app/components/plugins/plugin-item/action.tsx +++ b/web/app/components/plugins/plugin-item/action.tsx @@ -39,6 +39,10 @@ const Action: FC = ({ setFalse: hidePluginInfo, }] = useBoolean(false) const mutateInstalledPluginList = usePluginPageContext(v => v.mutateInstalledPluginList) + const [deleting, { + setTrue: showDeleting, + setFalse: hideDeleting, + }] = useBoolean(false) const handleFetchNewVersion = () => { } @@ -48,7 +52,9 @@ const Action: FC = ({ }] = useBoolean(false) const handleDelete = useCallback(async () => { + showDeleting() const res = await uninstallPlugin(pluginId) + hideDeleting() if (res.success) { hideDeleteConfirm() mutateInstalledPluginList() @@ -99,23 +105,21 @@ const Action: FC = ({ onHide={hidePluginInfo} /> )} - { - isShowDeleteConfirm && ( - - {t(`${i18nPrefix}.deleteContentLeft`)}{pluginName}{t(`${i18nPrefix}.deleteContentRight`)}
- {/* // todo: add usedInApps */} - {/* {usedInApps > 0 && t(`${i18nPrefix}.usedInApps`, { num: usedInApps })} */} - - } - onCancel={hideDeleteConfirm} - onConfirm={handleDelete} - /> - ) - } + + {t(`${i18nPrefix}.deleteContentLeft`)}{pluginName}{t(`${i18nPrefix}.deleteContentRight`)}
+ {/* // todo: add usedInApps */} + {/* {usedInApps > 0 && t(`${i18nPrefix}.usedInApps`, { num: usedInApps })} */} + + } + onCancel={hideDeleteConfirm} + onConfirm={handleDelete} + isLoading={deleting} + isDisabled={deleting} + /> ) }