The little dialogue that says "cannot connect to Trello" and has a "Reload" button - for a Mac user I think this pops up every time you wake from sleep (which is often), but there isn't really any connection problem. You can work with the board or change board and everything will work as it should, but the dialogue remains.
At least to my experience.
I'm not an expert in web technologies, but couldn't you have the dialogue disappear by itself as soon as you start interacting with Trello again and a connection is re-established?
(by the way I've seen the same thing in MS Power Apps, it will display a "Try again" button - more intrusive than the Trello one because you have to click it to continue working, but same type of mis-diagnosis from my point of view. Trello, you want to be at least better than MS here, don't you? 😉)