Skip to content

Commit

Permalink
Social: Fix share modal trigger presence (#39135)
Browse files Browse the repository at this point in the history
* Only show modal trigger if there are shares for the post

* changelog

* Use only socialStore
  • Loading branch information
gmjuhasz authored Aug 30, 2024
1 parent 75155fb commit b136156
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fixed

Fixed a bug on when to show the share log modal trigger
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ type ModalTriggerProps = ButtonProps & {
export const ModalTrigger = forwardRef(
( { withWrapper = false, ...props }: ModalTriggerProps, ref: unknown ) => {
const { openShareStatusModal } = useDispatch( socialStore );

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

// If the post is not shared anywhere, thus there is no share status or no shares, we don't need to show the trigger.
if ( ! shareStatus || ! shareStatus.shares || shareStatus.shares.length === 0 ) {
return null;
}

if ( ! featureFlags.useShareStatus ) {
return null;
Expand Down

0 comments on commit b136156

Please sign in to comment.