I've been in that position in the past, blind optimism. And I honestly cannot answer your question, as in, I really have no idea how I was doing it. I had gone through a loss (lost my father to cancer), through humiliations in high school, through pain, etc. And yet I still hoped for a better future. I've ben depressed since the second half of 2019 or so, so like half a decade almost, which in hindsight may be short compared to some people on here I guess. But I really liked your comment from another thread where you said there should be no comparison criterion, and I shouldn't compare my depression to others. Alas, I know and I feel that I could never go back to that blind optimism stage.
My depression opened my eyes and now I see the world and life itself, for what it really is, and it's hard to turn a blind eye to it. I don't want to go to therapy, because if they will just shove antidepressants down my throat to make the grass look greener, that's a fake view of the world. A really good friend of mine keeps asking me if I wouldn't go back to my 2018 persona (my happiest year of my life), and my answer is no. Which is a real headscratcher for them, since it's difficult to understand that I am suffering at the moment, but I wouldn't choose to go back to a time where I was not suffering. But that's just because I know that I was viewing the world through a filter. In some weird way, I am thankful that I now see things for what they are, and I am slowly mustering the courage to exit, instead of just living and coping until life throws who knows what hardship at me.