Depression gives you a negative outlook, regardless of how good your quality of life is. An irrational thought loop that whispers to you (or screams at you) that things will not get better. It's easy to conflate negative thoughts into reality.
If you do find a way out, the idea that life itself is sacred (regardless of quality of life) can help keep things in perspective for next time.
I deeply believe that depression is just physical brain damage and dark thoughts are just the symptom making harder for you to get treatment just like a pain in the knee might make it harder for you exercise it a bit or get to the doctor to get treatment. I don't think that dark thoughts by themselves cause depression or even directly contribute to it. Same way the feeling of pain doesn't make your knee worse.
I think it might be helpful to have distance to your feelings. To understand that unlike your thoughts, your feelings have direct purely biological source. You might find it easier to suffer through them, like you can suffer through limping.
I hope I'll never get depressed so I won't have to find out whether that makes any difference.
Depression is a negative thought loop that in the moment feels impossible to escape. Irrational thoughts seem rational. In a clinical sense depression (as a disorder) may be the cause. It persists even when your quality of life is good. That said, depression can also be an effect (triggered by a traumatic experience).
Distancing yourself from your feelings may help temporarily, drugs do that.
Occupying your mind with activities that provide a positive reward loop and positive feeling (hobbies, exercise, social activities) likely makes the most difference.
If you do find a way out, the idea that life itself is sacred (regardless of quality of life) can help keep things in perspective for next time.