Sorry to hear that. Wishing you a speedy and successful recovery. I'm headed for some shelf time myself. I just started to feel fully recovered from surgery to correct a mal-union of a pelvic fracture and a revision of a hip replacement last year. Now I'm headed for a knee replacement on Sept 7th.
I don't intend to stop riding either. A big part of the early stages of recovery for me is riding on the trainer since it's a controlled environment so it's a lot less risky than riding outside. I have a smart trainer and ride on Zwift which keeps the boredom at bay and it keeps the wife happy.

In any event it works for me. Good luck and keep riding!