Artifacts with multiple when

I am having the exact same issue and would really like a solution to this or know if it’s possible.