fix undefined bug

This commit is contained in:
caranicas 2022-09-18 20:40:17 -04:00
parent 7f3279f20f
commit fcf5c41709
3 changed files with 12 additions and 2 deletions

View File

@ -25,6 +25,12 @@ export default function CompletedImages({
<div className={completedImagesMain}>
{images &&
images.map((image, index) => {
if (void 0 === image) {
console.warn(`image ${index} is undefined`);
return null;
}
return (
<button
key={index}

View File

@ -97,8 +97,11 @@ export default function DisplayPanel() {
}
})
.flat()
.reverse();
.reverse()
.filter((item) => void 0 !== item); // remove undefined items
setCompletedImages(temp);
debugger;
setCurrentImage(temp[0] || null);
} else {
setCompletedImages([]);
@ -113,6 +116,7 @@ export default function DisplayPanel() {
<CurrentDisplay image={currentImage}></CurrentDisplay>
</div>
<div className={previousImages}>
<CompletedImages
images={completedImages}
setCurrentDisplay={setCurrentImage}

File diff suppressed because one or more lines are too long