# extendify/3.2.1/src/AutoLaunch/components/LaunchUpdate.jsx

Extendify, version 3.2.1. 60 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.2.1/code/src/AutoLaunch/components/LaunchUpdate.jsx
- Raw: https://pluginprobe.com/plugins/extendify/3.2.1/raw/src/AutoLaunch/components/LaunchUpdate.jsx
- Modified: 2026-09-09T18:23:40+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.2.1/code/src/AutoLaunch/components/LaunchUpdate.jsx#L10-L20`.

```jsx
import { WaitingOverlay } from '@auto-launch/components/Waiting';
import { forceReinstallPlugin, runUpdates } from '@auto-launch/functions/setup';
import { launchStrings } from '@auto-launch/strings';
import { digest } from '@shared/api/digest';
import { useCallback, useEffect } from '@wordpress/element';

// The reload is also the retry; the server bounds how many, so it can't loop.
export const LaunchUpdate = ({
	pluginUpdateNeeded,
	themeUpdateNeeded,
	pluginUpdateViaRest,
	pluginSlug,
	attempt,
}) => {
	const applyUpdates = useCallback(async () => {
		// Run serially, not concurrently: two WP upgraders fight over the shared
		// maintenance flag and filesystem.
		const phpUpdateNeeded =
			themeUpdateNeeded || (pluginUpdateNeeded && !pluginUpdateViaRest);
		try {
			if (phpUpdateNeeded) {
				const result = await runUpdates();
				if (result?.errors?.length) {
					throw new Error(result.errors.join('; '));
				}
			}
			if (pluginUpdateNeeded && pluginUpdateViaRest) {
				await forceReinstallPlugin(pluginSlug);
			}
		} catch (error) {
			digest({
				error,
				details: { source: 'auto-launch', caller: 'launch-update', attempt },
			});
		} finally {
			window.location.reload();
		}
	}, [
		pluginUpdateNeeded,
		themeUpdateNeeded,
		pluginUpdateViaRest,
		pluginSlug,
		attempt,
	]);

	useEffect(() => {
		applyUpdates();
	}, [applyUpdates]);

	const strings = launchStrings();

	return (
		<WaitingOverlay
			show
			message={strings.updating}
			note={strings.updatingNote}
		/>
	);
};

```
