I have an old Apple Magic Mouse, I got around 2010. It has grown so old that the notch of the aluminum cover that holds the batteries is cut, and as such, it does not close. I tape it in order to close the cover.
However, as people who use the same Magic Mouse for years have notices, it also randomly disconnects. Some people hit it to reconnect, but it disconnects again soon enough. The solution for this is to fold a piece of paper (like a Post-It) and place it between the batteries.
You owe me a coffee now :)
PS. You may not want to tape the aluminum cover. In such a case your solution is some blue-tac and hard paper