# extendify/3.1.6/src/PageCreator/state/plugins-cache.js

Extendify, version 3.1.6. 27 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.1.6/code/src/PageCreator/state/plugins-cache.js
- Raw: https://pluginprobe.com/plugins/extendify/3.1.6/raw/src/PageCreator/state/plugins-cache.js
- Modified: 2025-05-12T12:42:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.1.6/code/src/PageCreator/state/plugins-cache.js#L10-L20`.

```javascript
import apiFetch from '@wordpress/api-fetch';
import { create } from 'zustand';
import { persist } from 'zustand/middleware';

export const useInstalledPluginsCache = create(
	persist(
		(set) => ({
			installedPlugins: window.extSharedData?.activePlugins?.map(
				(plugin) => plugin.split('/')[0],
			),
			updateInstalledPlugins: async () => {
				const installedPlugins = (
					await apiFetch({
						path: '/wp/v2/plugins',
						method: 'GET',
					})
				)?.map((plugin) => plugin.plugin.split('/')[0]);

				set({ installedPlugins });
			},
		}),
		{
			name: `extendify-page-creator-page-installed-plugins-cache-${window.extSharedData.siteId}`,
		},
	),
);

```
