What you see is z fighting, meaning the depth z of the lines and the polygons are very close, and sometimes the one from the polygon is a little bit less than the one from the line, hiding the line.
You need to use the zOffset
property of the material to shift the z values a bit. However, it does not work when drawing lines, so use it with the polygon material: