Id do the mains first as its easier to connect that quickly, ie push fuse in. A clean power up is essential. Howver as soon as possible the nattery shoudl be connected. SOme panels need the battery to operate the protective device (ie the lower voltage fuse) if you have a wiring fault you can end up popping the panel with out the battery connected.
To be 100% safe fully charge the battery from the panel with nothing connect to the pnale (other than the mains and the battery)