Fix errors during initial grid lines rendering

[#57921064]