diff --git a/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx b/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx index 6d6784dea8..9f883af1b2 100644 --- a/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx +++ b/web/app/components/plugins/plugin-page/__tests__/install-plugin-dropdown.spec.tsx @@ -199,6 +199,7 @@ describe('InstallPluginDropdown', () => { const { container } = render() fireEvent.click(screen.getByTestId('dropdown-trigger')) + fireEvent.click(screen.getByText('plugin.source.local')) fireEvent.change(container.querySelector('input[type="file"]')!, { target: { files: [new File(['content'], 'plugin.difypkg')], @@ -235,6 +236,7 @@ describe('InstallPluginDropdown', () => { const { container } = render() fireEvent.click(screen.getByTestId('dropdown-trigger')) + fireEvent.click(screen.getByText('plugin.source.local')) fireEvent.change(container.querySelector('input[type="file"]')!, { target: { files: [new File(['content'], 'plugin.difypkg')], diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx index f74de31159..a972c9891c 100644 --- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx +++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx @@ -49,7 +49,8 @@ const InstallPluginDropdown = ({ }) const handleFileChange = (event: React.ChangeEvent) => { - const file = event.target.files?.[0] + const file = event.target.files?.[0] ?? null + event.target.value = '' if (file) { setSelectedFile(file) setSelectedAction('local') @@ -57,6 +58,13 @@ const InstallPluginDropdown = ({ } } + const handleCloseLocalInstaller = () => { + setSelectedAction(null) + setSelectedFile(null) + if (fileInputRef.current) + fileInputRef.current.value = '' + } + // TODO TEST INSTALL : uninstall // const [pluginLists, setPluginLists] = useState([]) // useEffect(() => { @@ -105,6 +113,13 @@ const InstallPluginDropdown = ({ return (
+ {t('installFrom', { ns: 'plugin' })} - {installMethods.map(({ icon: Icon, text, action }) => ( setSelectedAction(null)} + onClose={handleCloseLocalInstaller} onSuccess={noop} /> )}