Blocks inside a clone block seemingly executed even if condition is false

Accidentally submitted a topic as I was still typing which for some reason was automatically hidden so I’m creating a new one, will remove old one when it becomes visible

Hello, I’m new to thunkable but have quite a bit of programming experience so I didn’t have much problems creating things on here. However, a bug I recently encountered stumped me and although I did fix it, I’m not quite sure what the problem was. I am asking on here purely for the sake of knowing.

A bit of an overview on the app, it’s a remix of the drawing app on the sample projects. I added authentication using google and firebase, so that the user can save their drawings and look at it later. I save the drawings on to a firebase realtime database.

I was trying to display the images to the user by iterating through all the images stored in the database under their ID. I display the images in a layout component by cloning a base group into it. Each group can contain two images, each with their own label. Since a group contains two images, I keep track of whether I need to clone a new one or just use the last clone and make the second set of image and label visible.

Now, the bug i encountered was that the first image in the group always had the same image and label to the second image, if there was one. If there wasn’t a second image and label in the group, that group would display the correct image and label. The labels are just the unix time the drawing was saved on for now.

Faulty blocks and their output:

Fixed blocks and their output:

I had to merge the images as new users can only upload three in one post, i hope the quality didn’t degrade into it being unreadable.

So basically, the bug was fixed just by moving the blocks that set the properties of the image and label out of the clone block. This didn’t make any sense to me, since if the if statement had a false value, it should mean the image and label on the left has already been set, and only the statements on the else block, which set the image and label on the right, will execute. So my question is, why does moving those blocks out of the clone block affect the output that way?