@andromeda Sorry your still having issues. Only thing I could suggest on my little knowledge/experience would be to back up everything factory reset the tablet and try a clean install of ubports. It's a right old faff of a job but if its still doing it after that it may well be the hardware, thats if you haven't tried that already of course.
If its only restarting when charging it may be charger issue but I guess you've tried different chargers well/ cables as well.