I think that's something that you're going to have to find out for yourself. Everyone is different and has a different period of supercompensation, different lengths of DOMS and different pain tolerances (mostly from DOMS). I mean, if you literally can't walk from your last leg day, I personally wouldn't do legs again that day, but some people may tell me I'm wrong on that.
Overall, you are going to have to try training sore as **** and assess your results, try training after a long rest with minimal DOMS, try training while still being a little sore, and really anything else you can think of and find what gives you the best results.
If your muscle soreness is that bad on your next training day for that body part, try switching up your routine by maybe doing a different body part split (if you're following a program, stick with that program, as it probably wants you to feel the way you do), or you could try some creatine, as that is supposed to help with recovery, or switch up your diet, which may or may not help with recovery and DOMS (just spitballin here).
Personally, I train on how I feel. If my CNS is lacking or my shoulders are hurting or are sore, I'll take that day off and kill em the next day!
Maybe someone else can give you a more, "to-the-point" answer, but that is my two cents. Hope I could help!