I’m not sure, what I’m missing here, maybe someone can help me with that.
I’m trying to add a red border to the last image of the loop, and If it’s not the last image, add a green border.
Rather then using logic logic and inline styles, you can actually do this just with CSS. Give all the images the green border, and use :last-of-type on the li elements to change the image border on the last one.
Thank You @jimbobrjames, You’re completely right.
I broke this code down to a simpler example than my use case actually is.
Thanks @bvdputte, I already tried to invert the condition.
The actual error was a missing “sort” field for one of the images.
Now both hasNext() and isLast() work as expected.
PS: I would never add a 10px dashed red border to an image