In addition to checking the stability of the grid, the Powerwalls synchonize their own AC waveform to the grid before reconnecting. That is why the reconnection is seamless - there is no current flow across the switch when it reconnects.
That is pretty ingenious.