prevent files[index] is undefined errors

This commit is contained in:
Abhinav 2022-01-26 11:54:49 +05:30
parent 9b47830076
commit 2c5de102b2
2 changed files with 28 additions and 25 deletions

View file

@ -334,7 +334,8 @@ const PhotoFrame = ({
handleSelect(filteredData[index].id, index)(!checked);
}
};
const getThumbnail = (files: EnteFile[], index: number) => (
const getThumbnail = (files: EnteFile[], index: number) =>
files[index] ? (
<PreviewCard
key={`tile-${files[index].id}-selected-${
selected[files[index].id] ?? false
@ -357,6 +358,8 @@ const PhotoFrame = ({
(index >= currentHover && index <= rangeStart)
}
/>
) : (
<></>
);
const getSlideData = async (

View file

@ -439,7 +439,7 @@ export function PhotoList({
}
}
};
if (!timeStampList) {
if (!timeStampList?.length) {
return <></>;
}