OP, please don't learn the wrong lesson from this painful time. Don't be me.
The same thing happened to me, many years ago. I still remember the absolute shock, first of my lovely dad's sudden death, and then a few days later being dumped by my boyfriend. Feeling as if I had been hollowed out inside. Feeling as if nothing was safe, as if I didn't understand anything, and the world could turn upside down and throw me off at any moment. A truly horrible time, when I was young and hadn't been away from home long.
Unfortunately, I made a lot of mistakes (I think this happens very easily when you're bereaved). The ex came back a couple of weeks later and managed to convince me I'd got everything wrong and he hadn't dumped me. I'd never heard of gaslighting, and thought maybe I had misunderstood, so I took him back. I was very careful not to show a lot of grief. I thought I didn't have the right to involve anyone else in my sadness.
Meanwhile, he was quietly looking around for someone else. A few months later, when he'd got a new relationship well under way, he dumped me again.
The second time, I was even more devastated. I thought I'd failed to control my feelings enough, and become a needy, unloveable burden. Worse, I was hit with all the guilt and shame of having prioritised the ex over my family and minimised the loss of my dad.
After that, I made many mistakes in relationships. I was convinced that I must, basically, never express my needs or try to change a partner's mind. Looking back, I became a doormat with some men, and let others drift away because I couldn't fight for our relationship.
OP, please don't let this weak and selfish man crush you. You did nothing wrong. Don't believe you have to hide your natural grief. I hope you have friends or relatives who will hold your hand while you work through the worst of it, and encourage you on when your spirits start to rise again.
I was lucky and have now been happily married to a good man for many years. But the loss of self-confidence caused by one feckless boyfriend when I was vulnerable caused very long-lasting damage. I hope you have the happy future you deserve, OP and everyone else who has been through this.