Weird Scattermapbox lines behaviour

In a scatter plot the order of the points defines the lines to be drawn.

I hade something like this in the past: