Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix lint
  • Loading branch information
mkevins committed Jan 31, 2020
commit 617ea83862c54d8549b4395daaac887942691f8c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import { useRef } from '@wordpress/element';
import styles from './styles.scss';

// remove duplicates after gallery append
const dedupMedia = ( media ) => uniqWith( media, ( media1, media2 ) => {
return media1.id === media2.id || media1.url === media2.url;
} );
const dedupMedia = ( media ) =>
uniqWith( media, ( media1, media2 ) => media1.id === media2.id || media1.url === media2.url );

function MediaPlaceholder( props ) {
const {
Expand All @@ -42,9 +41,10 @@ function MediaPlaceholder( props ) {
mediaRef.current = value;

// append and deduplicate media array for gallery use case
const setMedia = multiple && addToGallery
? ( selected ) => onSelect( dedupMedia( [ ...mediaRef.current, ...selected ] ) )
: onSelect;
const setMedia =
multiple && addToGallery
? ( selected ) => onSelect( dedupMedia( [ ...mediaRef.current, ...selected ] ) )
: onSelect;

const isOneType = allowedTypes.length === 1;
const isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );
Expand Down