# extendify/3.1.0/src/PageCreator/hooks/usePageProfile.js

Extendify, version 3.1.0. 31 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.1.0/code/src/PageCreator/hooks/usePageProfile.js
- Raw: https://pluginprobe.com/plugins/extendify/3.1.0/raw/src/PageCreator/hooks/usePageProfile.js
- Modified: 2026-02-18T22:27:14+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.0/code/src/PageCreator/hooks/usePageProfile.js#L10-L20`.

```javascript
import { getPageProfile } from '@page-creator/api/DataApi';
import { usePageDescriptionStore } from '@page-creator/state/cache';
import { useGlobalsStore } from '@page-creator/state/global';
import { useSiteProfileStore } from '@shared/state/site-profile';
import { useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import useSWRImmutable from 'swr/immutable';

// Returns the site profile and page profile
export const usePageProfile = () => {
	const { description } = usePageDescriptionStore();
	const { setProgress, regenerationCount } = useGlobalsStore();
	const { siteProfile } = useSiteProfileStore();

	const { data, error } = useSWRImmutable(
		{ key: `page-profile-${regenerationCount}`, description, siteProfile },
		getPageProfile,
	);

	useEffect(() => {
		if (data) return;
		setProgress(__('Generating AI page profile...', 'extendify-local'));
	}, [data, setProgress]);

	return {
		pageProfile: data,
		error,
		loading: !data && !error,
	};
};

```
