When they reconnect it's longest chain according to protocol. You can read about "eclipse attack" - it's the same scenario if it's a disaster.
But you are right that it would be a shitshow because many transactions on one side would be undone and maybe a few individuals would have double spend.
In reality we assume that this would never happen because of how connected the internet is - especially with sattelites and stuff.