Skip to content

Commit

Permalink
Migrate more useShareStatus flag
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Aug 28, 2024
1 parent 3c1c8ca commit 16bb256
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useSelect } from '@wordpress/data';
import { store as socialStore } from '../../social-store';
import { getSocialScriptData } from '../../utils/script-data';
import { ThemedShareStatusModal as ShareStatusModal } from '../share-status';

export const GlobalModals = () => {
const featureFlags = useSelect( select => select( socialStore ).featureFlags(), [] );
const { feature_flags } = getSocialScriptData();

return <>{ featureFlags.useShareStatus ? <ShareStatusModal /> : null }</>;
return <>{ feature_flags.useShareStatus ? <ShareStatusModal /> : null }</>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { forwardRef } from 'react';
import { store as socialStore } from '../../social-store';
import { getSocialScriptData } from '../../utils/script-data';
import styles from './styles.module.scss';
import type { ButtonProps } from '@wordpress/components/build-types/button/types';

Expand All @@ -16,10 +17,9 @@ type ModalTriggerProps = ButtonProps & {
export const ModalTrigger = forwardRef(
( { withWrapper = false, ...props }: ModalTriggerProps, ref: unknown ) => {
const { openShareStatusModal } = useDispatch( socialStore );
const { feature_flags } = getSocialScriptData();

const featureFlags = useSelect( select => select( socialStore ).featureFlags(), [] );

if ( ! featureFlags.useShareStatus ) {
if ( ! feature_flags.useShareStatus ) {
return null;
}

Expand Down

0 comments on commit 16bb256

Please sign in to comment.