Skip to content

Commit

Permalink
Get rid of refreshJetpackSocialSettings action
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Oct 31, 2024
1 parent bd937f3 commit 532ab86
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 74 deletions.
1 change: 0 additions & 1 deletion projects/js-packages/publicize-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export { default as TemplatePickerButton } from './src/components/social-image-g
export { default as PublicizePanel } from './src/components/panel';
export { default as ReviewPrompt } from './src/components/review-prompt';
export { default as PostPublishPanels } from './src/components/post-publish-panels';
export { default as RefreshJetpackSocialSettingsWrapper } from './src/components/refresh-jetpack-social-settings';
export { default as ConnectionManagement } from './src/components/connection-management';

export { default as useSocialMediaConnections } from './src/hooks/use-social-media-connections';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as connectionData from './connection-data';
import siteSettingActions from './jetpack-settings';
import jetpackSocialSettings from './jetpack-social-settings';
import * as shareStatus from './share-status';
import socialNotesSettings from './social-notes-settings';

const actions = {
...shareStatus,
...siteSettingActions,
...jetpackSocialSettings,
...connectionData,
...socialNotesSettings,
};
Expand Down

This file was deleted.

32 changes: 12 additions & 20 deletions projects/plugins/jetpack/_inc/client/sharing/publicize.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { getRedirectUrl } from '@automattic/jetpack-components';
import {
ConnectionManagement,
RefreshJetpackSocialSettingsWrapper,
features,
} from '@automattic/jetpack-publicize-components';
import { ConnectionManagement, features } from '@automattic/jetpack-publicize-components';
import { siteHasFeature } from '@automattic/jetpack-script-data';
import { createInterpolateElement } from '@wordpress/element';
import { __, _x } from '@wordpress/i18n';
Expand Down Expand Up @@ -151,21 +147,17 @@ export const Publicize = withModuleSettingsFormHelpers(
{ __( 'Automatically share your posts to social networks', 'jetpack' ) }
</span>
</ModuleToggle>
<RefreshJetpackSocialSettingsWrapper
shouldRefresh={ ! isActive && this.props.isSavingAnyOption( 'publicize' ) }
>
{ shouldShowChildElements && hasSocialImageGenerator && (
<SocialImageGeneratorSection />
) }
{ isActive &&
isLinked &&
useAdminUiV1 &&
! this.props.isSavingAnyOption( 'publicize' ) ? (
<FormFieldset className="jp-settings__connection-management">
<ConnectionManagement />
</FormFieldset>
) : null }
</RefreshJetpackSocialSettingsWrapper>
{ shouldShowChildElements && hasSocialImageGenerator && (
<SocialImageGeneratorSection />
) }
{ isActive &&
isLinked &&
useAdminUiV1 &&
! this.props.isSavingAnyOption( 'publicize' ) ? (
<FormFieldset className="jp-settings__connection-management">
<ConnectionManagement />
</FormFieldset>
) : null }
</SettingsGroup>
) }
{ isActive && ! useAdminUiV1 && configCard() }
Expand Down
19 changes: 2 additions & 17 deletions projects/plugins/social/src/js/components/admin-page/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
features,
} from '@automattic/jetpack-publicize-components';
import { siteHasFeature } from '@automattic/jetpack-script-data';
import { useSelect, useDispatch } from '@wordpress/data';
import { useState, useCallback, useEffect, useRef } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { useState, useCallback } from '@wordpress/element';
import React from 'react';
import PricingPage from '../pricing-page';
import SocialImageGeneratorToggle from '../social-image-generator-toggle';
Expand All @@ -32,8 +32,6 @@ const Admin = () => {
const showConnectionCard = ! isRegistered || ! isUserConnected;
const [ forceDisplayPricingPage, setForceDisplayPricingPage ] = useState( false );

const refreshJetpackSocialSettings = useDispatch( socialStore ).refreshJetpackSocialSettings;

const onPricingPageDismiss = useCallback( () => setForceDisplayPricingPage( false ), [] );

const { isModuleEnabled, showPricingPage, pluginVersion, isUpdatingJetpackSettings } = useSelect(
Expand All @@ -48,19 +46,6 @@ const Admin = () => {
}
);

const hasEnabledModule = useRef( isModuleEnabled );

useEffect( () => {
if (
isModuleEnabled &&
! hasEnabledModule.current &&
siteHasFeature( features.IMAGE_GENERATOR )
) {
hasEnabledModule.current = true;
refreshJetpackSocialSettings();
}
}, [ isModuleEnabled, refreshJetpackSocialSettings ] );

const moduleName = `Jetpack Social ${ pluginVersion }`;

if ( showConnectionCard ) {
Expand Down

0 comments on commit 532ab86

Please sign in to comment.