Here’s a good tip for writers.
If you’re realising that you’re feeling down, angry, easily upset, or snippy constantly, look at what you’re writing.
Is it heavily sad? Angst? Are your characters irrationally angry, or perhaps have bad intentions or are suffering horrible experiences?
Take a step back from it.
Write something happy. Start working on some more positive stuff.
Separate yourself from the suffering of your characters, even if just for a while. Let yourself be immersed in a happy world where everything goes right.
I had a period of time that I wrote a heavily abusive, depressed, mentally ill character. His emotions began to affect mine. I would get upset over the littlest things and get mad at people. My depression took a hardcore nosedive.
I stopped writing him for a while.
My mood improved. I started feeling better.
I wrote some sappy, outrageously happy things.
And you know? It helped. I could go back and write him again, for short periods of time, but I’d always return to the happy stuff later. Even if it was just private stuff that I didn’t share with anyone. I kept that stuff in my head and it improved my mood a whole lot.
Don’t let your sad ideas take over your brain. Don’t let it become the only thing you focus on. Don’t hurt yourself over your writing.