Hi @Typal I'm so so sorry for your loss 💔 that is truly heartbreaking. 😥
I'm not an expert, but I'm going to say no, it's not going to have an affect on baby's mental health.At least not to the extent that you couldn't undo it once baby is born, if that makes sense. Please don't worry - you don't need the added stress of worrying about this on top of what you're going through ❤️ .
The way we treat our babies and children is incredibly important for their mental health, but this is after they've been born. Things like always responding to their physical and emotional needs, ensuring they are loved and safe etc - that is what is going to set them up well for good mental health in life.
Going through grief during pregnancy is not going to affect your baby's mental health later on. I don't like it when people talk about stress etc affecting the fetus because honestly it puts too much "blame" and responsibility on the mother for something that often cannot be changed. We can't change how we are feeling, a lot of the time. Ofc it's good to seek support and mental health services and this can help.
Sending you lots of love and good vibes. For what it's worth, my mum was alone and homeless for a while when pregnant with me - extremely stressed etc. She's always loved me and met my needs and I'm doing absolutely fine 🙂 never had any serious mental health problems and no developmental delays etc. Xx