fix: disable adding same embedded url in onAddBox

This commit is contained in:
dan13ram
2022-01-08 13:38:12 +05:30
committed by dan13ram
parent 19f3b7fac2
commit b91538fc0a
2 changed files with 5 additions and 0 deletions

View File

@@ -162,6 +162,7 @@ const LinkPreview: React.FC<LinkPreviewProps> = ({
backgroundImage: `url(${image})`,
height: 'auto',
flex: 1,
minH: '12rem',
width: '100%',
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',

View File

@@ -313,6 +313,10 @@ export const Grid: React.FC<Props> = ({ player }): ReactElement => {
const onAddBox = useCallback(
(boxType: BoxType, boxMetadata: BoxMetadata): void => {
const boxKey = getBoxKey(boxType, boxMetadata);
if (currentLayoutItems.find((item) => item.boxKey === boxKey)) {
return;
}
const layoutData = {
layouts: addBoxToLayouts(boxType, boxMetadata, currentLayouts),
layoutItems: [