diff --git a/src/redux/plugins/plugins.reducers.ts b/src/redux/plugins/plugins.reducers.ts index 4f3736015b7da8c2c064f7c0524231b1f9e59e63..f3d74473b3f3f80f57c8d1319ebeabf987b4412a 100644 --- a/src/redux/plugins/plugins.reducers.ts +++ b/src/redux/plugins/plugins.reducers.ts @@ -1,4 +1,5 @@ import type { ActionReducerMapBuilder } from '@reduxjs/toolkit'; +import { ZERO } from '@/constants/common'; import { getAllPlugins, registerPlugin } from './plugins.thunks'; import type { PluginsState, @@ -15,7 +16,9 @@ export const removePluginReducer = (state: PluginsState, action: RemovePluginAct export const registerPluginReducer = (builder: ActionReducerMapBuilder<PluginsState>): void => { builder.addCase(registerPlugin.pending, (state, action) => { const { hash } = action.meta.arg; - state.activePlugins.pluginsId.push(hash); + if (state.activePlugins.pluginsId.indexOf(hash) < ZERO) { + state.activePlugins.pluginsId.push(hash); + } }); builder.addCase(registerPlugin.fulfilled, (state, action) => { if (action.payload) {