Visual error when hiding elements in view Python

When hiding some elements with python in this view a colleague of mine noticed some weird lines.
The lines are still visible when i plot the view but will be gone when restarting the model.
Also i could not replicate this problem on my PC but some other colleague of mine was able to replicate the problem.
Revit version 2022
Does anybody know how i can fix this?

Hi @MelleH ,

It would be helpful if you brought your car to the garage, please share the used script(s) and sample file(s).


It is part of a very large script of about 1500 lines used for creating an assembly, its views and its schedules.
The definition i use for hiding elements is:

def HideInView(Elementen, View = view):

See if you can simplify it down to a repeatable case with just a few lines of code.