diff --git a/src/components/Map/Drawer/AvailablePluginsDrawer/LoadPlugin/hooks/useLoadPlugin.ts b/src/components/Map/Drawer/AvailablePluginsDrawer/LoadPlugin/hooks/useLoadPlugin.ts index b55c9e3e9af407b43e34bab7cfe025dc9e308f61..b718951da761b8fcddb8313d1d55a12302913efe 100644 --- a/src/components/Map/Drawer/AvailablePluginsDrawer/LoadPlugin/hooks/useLoadPlugin.ts +++ b/src/components/Map/Drawer/AvailablePluginsDrawer/LoadPlugin/hooks/useLoadPlugin.ts @@ -105,7 +105,11 @@ export const useLoadPlugin = ({ }; const handleReloadPlugin = async (): Promise<void> => { - handleUnloadPlugin(); + PluginsManager.removePluginContent({ hash }); + + PluginsManager.unloadActivePlugin(hash); + + PluginsEventBus.dispatchEvent('onPluginUnload', { hash }); await handleLoadPlugin(); }; diff --git a/src/components/Map/PluginsDrawer/PluginsHeader/PluginHeaderInfo/PluginHeaderInfo.component.test.tsx b/src/components/Map/PluginsDrawer/PluginsHeader/PluginHeaderInfo/PluginHeaderInfo.component.test.tsx index 7729070d1d97ece8514b28bf4d6b3b5dcac8af70..d8465b3a4772a94795da9fa57b963355c2c10a32 100644 --- a/src/components/Map/PluginsDrawer/PluginsHeader/PluginHeaderInfo/PluginHeaderInfo.component.test.tsx +++ b/src/components/Map/PluginsDrawer/PluginsHeader/PluginHeaderInfo/PluginHeaderInfo.component.test.tsx @@ -80,26 +80,16 @@ describe('PluginHeaderInfo - component', () => { }); it('reload plugin on reload button', async () => { - const { store } = renderComponent(STATE, PLUGIN); + renderComponent(STATE, PLUGIN); mockedAxiosClient.onGet(PLUGIN.urls[FIRST_ARRAY_ELEMENT]).reply(HttpStatusCode.Ok, ''); const button = screen.getByRole(RELOAD_PLUGIN_DRAWER_BUTTON_ROLE); button.click(); - const actions = store.getActions(); - expect(removePluginContentSpy).toHaveBeenCalledWith({ hash: PLUGIN.hash, }); - expect(actions).toEqual([ - { payload: { pluginId: '5e3fcb59588cc311ef9839feea6382eb' }, type: 'plugins/removePlugin' }, - { - payload: '5e3fcb59588cc311ef9839feea6382eb', - type: 'legend/removePluginLegend', - }, - ]); - await waitFor(() => { expect(setHashedPluginSpy).toHaveBeenCalledWith({ pluginScript: '',