import { Button, CheckboxControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; import { useLayoutEffect, useState } from 'react'; import { useSelector } from 'calypso/state'; import { isFetchingNotificationsSettings } from 'calypso/state/notification-settings/selectors'; type AllSitesProps = | { isApplyAllVisible: never | false } | { isApplyAllVisible: true; onSaveToAll(): void }; type NotificationSettingsFormActionsProps = { disabled: boolean; onSave(): void; } & AllSitesProps; const NotificationSettingsFormActions = ( { disabled, onSave, ...props }: NotificationSettingsFormActionsProps ) => { const translate = useTranslate(); const isFetching = useSelector( isFetchingNotificationsSettings ); const [ savingTarget, setSavingTarget ] = useState< 'single' | 'all' >( 'single' ); useLayoutEffect( () => { if ( ! isFetching ) { setSavingTarget( 'single' ); } }, [ isFetching ] ); return (