PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/AutoLaunch/hooks/useInstallRequiredPlugins.js +2 -5 3.1.23.2.1 View file →
@@ -2,12 +2,10 @@
2 2 import { ensurePluginsActive } from '@auto-launch/functions/plugins';
3 3 import { useEffect, useRef } from '@wordpress/element';
4 4 import useSWR from 'swr/immutable';
5 5
6 -const { installedPluginsSlugs } = window.extSharedData || {};
7 -
8 -export const useInstallRequiredPlugins = () => {
9 - const { data, error } = useSWR('required-plugins', () =>
6 +export const useInstallRequiredPlugins = ({ enabled = true } = {}) => {
7 + const { data, error } = useSWR(enabled ? 'required-plugins' : null, () =>
10 8 handleSitePlugins({ requiredOnly: true }),
11 9 );
12 10 const started = useRef(false);
13 11
@@ -15,9 +13,8 @@
15 13 if (started.current || !data?.sitePlugins?.length) return;
16 14 started.current = true;
17 15 ensurePluginsActive(
18 16 data.sitePlugins.map(({ wordpressSlug }) => wordpressSlug),
19 - { installedSlugs: installedPluginsSlugs },
20 17 );
21 18 }, [data]);
22 19
23 20 return {