Skip to content

Commit 332e6ca

Browse files
shashjarpriscilawebdev
authored andcommitted
ref(plugins): Deprecate the withPlugins HOC, the plugin action creators, and PluginStore (#102543)
Precursor for #101776. Deprecates: - The `withPlugins` higher-order component - The plugin action creators (`fetchPlugins`, `enablePlugin`, `disablePlugin`) - The `PluginStore` These components now rely on: - `useApiQuery` to fetch the plugins list / plugin details - A hook (`useTogglePluginMutation`) to mutate plugin statuses
1 parent a6adf4c commit 332e6ca

File tree

14 files changed

+293
-873
lines changed

14 files changed

+293
-873
lines changed

static/app/actionCreators/plugins.tsx

Lines changed: 0 additions & 129 deletions
This file was deleted.

static/app/components/pluginList.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
import {disablePlugin} from 'sentry/actionCreators/plugins';
21
import Panel from 'sentry/components/panels/panel';
32
import PanelItem from 'sentry/components/panels/panelItem';
43
import PluginConfig from 'sentry/components/pluginConfig';
54
import {t} from 'sentry/locale';
65
import type {Plugin} from 'sentry/types/integrations';
7-
import type {Organization} from 'sentry/types/organization';
86
import type {Project} from 'sentry/types/project';
7+
import {useTogglePluginMutation} from 'sentry/views/settings/projectPlugins/useTogglePluginMutation';
98

109
type Props = {
11-
organization: Organization;
1210
pluginList: Plugin[];
1311
project: Project;
14-
onDisablePlugin?: (plugin: Plugin) => void;
15-
onEnablePlugin?: (plugin: Plugin) => void;
1612
};
1713

18-
function PluginList({
19-
organization,
20-
project,
21-
pluginList,
22-
onDisablePlugin = () => {},
23-
}: Props) {
14+
export default function PluginList({project, pluginList}: Props) {
15+
const togglePluginMutation = useTogglePluginMutation({
16+
projectSlug: project.slug,
17+
});
2418
const handleDisablePlugin = (plugin: Plugin) => {
25-
disablePlugin({
26-
projectId: project.slug,
27-
orgId: organization.slug,
19+
togglePluginMutation.mutate({
2820
pluginId: plugin.slug,
21+
shouldEnable: false,
2922
});
30-
31-
onDisablePlugin(plugin);
3223
};
3324

3425
if (!pluginList.length) {
@@ -56,5 +47,3 @@ function PluginList({
5647
</div>
5748
);
5849
}
59-
60-
export default PluginList;

static/app/stores/pluginsStore.spec.tsx

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)